calebgrove / content-viewer

A nifty little Kirby widget that allows you to show a block of Kirbytext or Markdown content in Kirby's panel.
MIT License
15 stars 6 forks source link

Error Loading Widget #4

Closed shoesforindustry closed 6 years ago

shoesforindustry commented 6 years ago

Call to a member function text() on boolean /site/plugins/content-viewer/widget/widget.php Line 7: if($page->$field()->value()->isNotEmpty()){

Multi-lingual Site Kirby version: 2.5.7 PHP 7.0.25

any ideas?

calebgrove commented 6 years ago

Nothing right off the top of my head. Could you put together a test for me to play with?

calebgrove commented 6 years ago

And have you modified the plugin at all? Line 7 should be if($page->$field()->isNotEmpty()){, not if($page->$field()->value()->isNotEmpty()){

shoesforindustry commented 6 years ago

Thanks, I tried that same error. No real example just download starter pack and add plugin, it fails with the error above.

calebgrove commented 6 years ago

Could you try this?

Replace lines 9 and 10 of content-viewer.php with:

if(!site()->pages()->findBy('intendedTemplate', 'content-viewer')) {
    site()->pages()->create('content-viewer', 'content-viewer', array(

All I've done is add pages() to the logic, and it seems to be working for me.