Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

[Admin] Added Route Parameters to MenuNodeAdmin #109

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BadPixxel
Copy link

Added support of routes parameters in Menu Nodes Admin Page.
image

Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for this pull request! good point, we should have this.

'uri' => array('link'),
'content' => array('content', TreeSelectType::class),
),
'placeholder' => 'auto',
'required' => false,
))
->add('link', TextType::class, array('required' => false, 'mapped' => false))
->add('routeParameters', KeyValueType::class, array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently the key-value bundle is an optional dependency. even if we would make it a hard dependency, the user still needs to load the bundle in the kernel.

i think we should have an options array in the constructor to choose whether route parameters should be editable. then the DI extension can check whether the keyvaluebundle is loaded and complain if its not. the seo bundle form type does this, see the form and the DI extension and configuration

can you please add the configuration for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BadPixxel any chances to get this one ready. Or shall we finish it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thansk for you feedback. I'll do it, just need time.
Question... shall we filter only route parameters or whole route configuration options?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would only make the route parameters optional. the rest works without the key-value bundle

@BadPixxel
Copy link
Author

I finaly used cmf_sonata_phpcr_admin_integration.menu.extension.menu_options.advanced as it already check presence of burgov/key-value-form-bundle on DI

@dbu
Copy link
Member

dbu commented Apr 26, 2017

the problem with this is that the configuration is specifically about the menu options extension. i think we need to have a separate config option for this. but we can refactor MenuAdminFactory to have a method to check availability of the burgov bundle

Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are getting there. i commented on some cleanups i would love to see.

@@ -34,6 +34,11 @@
protected $menuRoot;

/**
* @var bool
*/
protected $useBurgovKeyValueForm;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this on the base class? it is only used in one place, lets move it to the specific class until we need it in more places.

@@ -38,6 +38,7 @@ public function addConfiguration(NodeBuilder $builder)
{
$builder
->booleanNode('recursive_breadcrumbs')->defaultTrue()->end()
->booleanNode('use_burgov_keyvalue_form')->defaultFalse()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plesae make this a true/false/auto option node like in the seo configuration

{
$bundles = $container->getParameter('kernel.bundles');

$container->setParameter('cmf_sonata_phpcr_admin_integration.menu.use_burgov_keyvalue_form', isset($bundles['BurgovKeyValueFormBundle']) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ignores the value set in the configuration. please use the logic as in the SEO DI extension to check for the bundle if the value is auto, and fail if set to true and burgov is missing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants