IgorBenko / pimcore-language-switcher

LanguageSwitcher is a Pimcore plugin that makes managing multi-lingual websites a whole lot easier and straightforward. Its main function is to find related nodes in parallel branches and to easily create menus for jumping to the same subpage in other languages - in the frontend and in the backend.
5 stars 1 forks source link

Fatal error if one root branch has no childs, while others have at least 2 sub-levels #1

Open micru opened 9 years ago

micru commented 9 years ago

Hi,

there seems to be a problem when one of the branch-roots has no childs at all, while some other branches have at least 2 sub-levels.

The Problem is reproducible with the following document structure: /de/uber-uns/team /en/about/team /fr

When i open the german or english team document, i get the following error: Fatal error: Call to a member function getChilds() on a non-object in /var/www/sites/project/htdocs/plugins/LanguageSwitcher/lib/LanguageSwitcher/Switcher.php on line 139 pimcore Version: 3.0.5 (Build: 3450)

As a workaround, i check if the getChilds method exists before calling it. But i am aware that this is just a basic workaround.

Nevertheless great work and a really helpful extension. Thanks a lot!

IgorBenko commented 9 years ago

Hi Michael,

thanks for your bug report. I will look into it and fix it. The plugin kind of expects the same structure in all branches, but yeah that's not the best way to handle this :)

Thanks a lot for your feedback!

Cheers