bacbos / bolt-menu-editor

a visual menu-editor extension for the awesome bolt cms
Other
21 stars 23 forks source link

No Support For Dynamic Menus #78

Closed matt-sonata closed 6 years ago

matt-sonata commented 6 years ago

BoltCMS allows for dynamic menus to be created that automatically populate with a chosen contenttype, as show in the documentation: https://docs.bolt.cm/3.4/configuration/menus#dynamic-menus

When trying to access the Bolt Menu Editor with a dynamic menu already set up in the menu.yml file, a twig error is thrown, due to array to string conversion. The part of the code that triggers the error is in templates>menueditor.twig, line 26.

Bolt Version: 3.4.8 Menueditor Version: 3.2.4

SvanteRichter commented 6 years ago

Right, it'd be nice to support them, but there is no way to determine what is a "dynamic menu" and what is not (and even less so how they would work), since that is just meta info added to menu file and executed from in the template twig file (I wrote the basis for that example in the docs). We could perhaps just ignore arrays in the code and I'd be willing to merge such a change, but it does not fix the underlying issue which is that if you add your own syntax to menu.yml the menueditor will not understand it, and there is the risk of the menueditor overwriting that metadata if menus are saved in it.

matt-sonata commented 6 years ago

Perhaps the extension could save to a different file which is then appended onto the menu.yml file? It's probably best if the file the extension generates is never manually edited.

As for determining whether a menu is dynamic or not, would it work to look for a term that is only present in dynamic menus like 'list' or 'contenttype'?

SvanteRichter commented 6 years ago

Closing cause custom syntax in menu.yml can't be properly supported. If someone has a PR that in a good way ignores it I'd be open to merging it though.