kongondo / MenuBuilder

Easily create navigation lists/menus using drag and drop
GNU General Public License v2.0
21 stars 8 forks source link

Uncaught Error: Call to a member function getLanguageValue() on string #46

Closed iamwebrocker closed 1 year ago

iamwebrocker commented 3 years ago

Hi,

there's an error when trying to use the "pages selector" function for menu items in the backend - in a non-multilanguage install, but with a (german) language pack installed for the default language, with PW3.0.165 and MenuBuilder 0.2.7

I suspect this is a similar issue as the one back in 2015, and line 2683 in ProcessMenuBuilder.module:

'title' => $title = is_null($language) ? $item->title : $item->title->getLanguageValue($language),

is to blame and the check method_exists(wire('pages')->get($itemID)->title, 'getLanguageValue') also needs to be applied here. I changed the line to:

'title' => $title = is_null($language) || !method_exists(wire('pages')->$item->title, 'getLanguageValue') ? $item->title : $item->title->getLanguageValue($language),

and now it works (for my setting)

cheers, and thanks for the great module Tom