contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

Remove page id from Custom Navigation when Page is deleted #1644

Closed x-christian-romeni closed 6 years ago

x-christian-romeni commented 6 years ago

I'm not sure if this is a real bug, but maybe someone could have a look.

Lets say you have 3 Pages (1=>A, 2=>B, 3=>C) And all of them are selected in a core Module: Custom Navigation.

When deleting Page B (ID 2), it seems to stay in the Database entry of the Custom Navigation.

Usually this does not seem to be a problem. But I have written a small Custom Navigation Extention based on changelanguage 3 that finds the corresponding Page in the current language, so only one Custom Navigation module is needed on a multi language site. To find the right page, I used findAssociatedForLanguage, which expects a PageModel as first parameter. The problem, when the PageModel returns nothing because the ID is not found, everything breaks. I know, I could add another if, to prevent that. But that does not fix the problem, just takes it a step further..

What do you think?

aschempp commented 6 years ago

I think this is something you should fix in your extension. It is not possible to remove the ID from customNavigation as we don't know all the places where page IDs are being used.