kongondo / MenuBuilder

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

Fatal error: getLanguageValue() #22

Closed flipzoom closed 8 years ago

flipzoom commented 9 years ago

If I add a new menu item via ASM-select and select the home side, I get the following error. I have two languages, default (English) and German.

Error: Call to a member function getLanguageValue() on a non-object (line 1750 of C:\wamp\www\development\XXX\site\modules\ProcessMenuBuilder\ProcessMenuBuilder.module) 

PW-version: 2.5.29-dev / 2.6 RC1

flipzoom commented 9 years ago

Via Page autocomplete I can't add any page. I pick them, click on this, but it is not added. Nothing happens. It is shown no Javascript errors.

flipzoom commented 9 years ago

It could be because I did not define the pages multilingual. Only the backend should be bilingual. So the title in Line 1750 does not exist in two languages. I have only the "language support" enabled but not the module "Page Title (multi-language)".

So here is the fix for line #L1750:

if($language != null AND wire('modules')->isInstalled('FieldtypePageTitleLanguage')) $itemTitle = wire('pages')->get($itemID)->title->getLanguageValue($language);//title of each PW page in this array
kongondo commented 9 years ago

Thanks. A bit tied up at the moment. Hoping to look into this by next week.

ivangretsky commented 8 years ago

Any progress on that?

kongondo commented 8 years ago

Unfortunately no. I am setting aside time next week to catchup on this and other issues.

ivangretsky commented 8 years ago

Good! Hope you'll find time. It seems to be important issue reported by many.

kongondo commented 8 years ago

I got some time to work on this. I have not been able to replicate the issue. I am testing with the latest dev version of ProcessWire and using the vanilla Multi Lingual profile.

Thanks.

ivangretsky commented 8 years ago

I think this error occurs when you first install menu builder, create a menu and only then install language support. You even cannot see pages created after language support installation in pages select dropdown.

kongondo commented 8 years ago

I really need a 'dummies' step-by-step instructions to reproduce this since I don't use nor know how to use, nor how to set up a multilingual site (especially given that there are various ways to set up such sites). So, for now, I am closing this issue until I can get such instructions :-(

ivangretsky commented 8 years ago

This issue is still not solved, so please let's open it and get it fixed.

This is a step-by-step to reproduce it:

  1. Install a copy of PW with site-default profile, add a few pages.
  2. Install MenuBuilder.
  3. Create a menu with MenuBuilder, add a few pages to it. I did render it to check if it works, but it is optional.
  4. Install Languages Support core module.
  5. Try to add a page to menu created with MenuBuilder and save.
  6. Get an error message like: Error: Call to a member function getLanguageValue() on a non-object (line 1750 of C:\xampp\htdocs__pw\site\modules\ProcessMenuBuilder\ProcessMenuBuilder.module
flipzoom commented 8 years ago

Exactly. And for this scenario, I have already posted a fix.

Line 1750

if($language != null AND wire('modules')->isInstalled('FieldtypePageTitleLanguage')) $itemTitle = wire('pages')->get($itemID)->title->getLanguageValue($language);//title of each PW page in this array
kongondo commented 8 years ago

OK. Thanks @ivangretsky. The reason I couldn't reproduce it (I think) was because I tested with a site-languages. @FlipZoomMedia, thanks for the fix. The reason I was hesitant to apply it is that I couldn't reproduce the bug and needed to do that first before applying your fix :-)

ivangretsky commented 8 years ago

Thank you for reopening the issue. Does FlipZoomMedia's fix work good enough to be included in master? Or are you working on something more complex?

I realy want this done, as you can see))

kongondo commented 8 years ago

Accepted @BitPoet's PR (4d1b015493c54aa60aeda8c22295ac0a909e9afe) (with respect to issue #25). This is now fixed and available in version 011 (master and dev), thanks all.