symfony-cmf / simple-cms-bundle

UNMAINTAINED - A more-than-simple cms based on the cmf components
http://cmf.symfony.com/
49 stars 45 forks source link

knp renders nodes that doesn't have labels #119

Closed mkoosej closed 10 years ago

mkoosej commented 10 years ago

After doing a composer update , the items that doesn't have labels and shouldn't be in the menu showed up. I'm using knp_menu_render twig function to render a branch of my tree that contains simpleCms nodes.

my composer.json: { ... "symfony/symfony": "2.3.", "symfony-cmf/symfony-cmf": "1.1.", "symfony-cmf/simple-cms-bundle": "1.1.", "knplabs/knp-menu-bundle": "1.1." ... }

Do you have any clue why this node passed down to renderer?

benglass commented 10 years ago

The previous logic for whether a Page was rendered in the menu was whether the label field was empty or not. With the 1.1 update this has been moved into a separate explicit property on Page called display

https://github.com/symfony-cmf/SimpleCmsBundle/blob/master/Doctrine/Phpcr/Page.php#L103

$page = $documentManager->find($pageClass, '/cms/simple/my/page');
$page->setDisplay(false);
$documentManager->persist($page);
$documentManager->flush();

You will need to write a 1 time script that sets this display value to false for any pages that have no labels to achieve the previous behavior.

mkoosej commented 10 years ago

Thanks for the clarification. I think updating the Admin class would be great. I can merge my own code after adding this.

benglass commented 10 years ago

@mkoosej yes we have an open issue for allowing management of these fields in the SimpleCmsBundle PageAdmin class https://github.com/symfony-cmf/SimpleCmsBundle/issues/114

Would you mind submitting a PR?

mkoosej commented 10 years ago

Sure. I'm working on adding those options today.