-
Notifications
You must be signed in to change notification settings - Fork 48
allow defaults for the options #128
Comments
/cc @elHornair |
Would like to second this as it makes this bundle more user-friendly. |
this should probably build on #214 as the way items are created from the nodes is refactored with knp 2.0 i think you could propose a Extension in https://github.com/KnpLabs/KnpMenu/tree/master/src/Knp/Menu/Factory that accepts an array of defaults and maybe a merge policy (keep existing or overwrite, defaulting to keep existing options) and implements buildOptions to add the default options that are not set in $options. that extension can then be configured as service in KnpMenuBundle and have configuration in knp_menu |
👍 does it make sense to add this to the KnpMenuBundle or this bundle? |
i think this should go to KnpMenu, its not a specific need for the cmf |
thanks |
we could allow to configure defaults for things like childrenAttributes on the ContentAwareFactory. in knp menu, those must be set on the objects, but as menu items are created programmatically, that is ok. for the cmf however this would mean storing data into the database even if it is a default.
i would draw the line at saying we can configure defaults for the things mapped in phpcr that will be applied to all menu items being created if they do not themselves provide that option. any logic to only apply the defaults to some menu items will require to extend the factory in your project, otherwise it gets too complex imo.
alternatively we could think of having MenuItemEnhancer like we have RouteEnhancer...
The text was updated successfully, but these errors were encountered: