0
votes

I am working with symfony cmf on a cms page. Currently i am trying to edit the label property from a Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page object.

In my twig template i have the following:

   {% createphp page as="rdf" %}
       <h1 {{ createphp_attributes(rdf) }}>{{ createphp_content(rdf) }}</h1>
   {% endcreatephp %}

I dont really know how i can get this to work so that only the label changes. When i dump the rdf object it will just show me two properties underneath the _children property "title" and "body". When i try to enter rdf.label, it gives me the error that label is not an existing property. Maybe somebody has managed to solve this before and can help me out with it. I would be really thankful.

1
This example looks wrong: It would output all mapped fields of the page inside the <h1> tag. You need to use rdf.title and rdf.body to output each part separately. And wrap things into a <div> that outputs the general item attributes with createphp_attributes(rdf). An example template is at symfony.com/doc/master/cmf/bundles/create/…dbu
Thanks for your response dbu. The thing is that in Frontend we display the label attribute for an page as the name of the page. we supposed that the title attribute is just for outputting it in the title tag of the html page. if i do rdf.title then it only changes the title and not the label. How can i achieve to change the label instead the title at this state?user3676604

1 Answers

0
votes

The mapping is defined in this file https://github.com/symfony-cmf/SimpleCmsBundle/blob/master/Resources/rdf-mappings/Symfony.Cmf.Bundle.SimpleCmsBundle.Doctrine.Phpcr.Page.xml

The menu label is in the middle of the menu and thus hard to highlight as editable. This is a conceptual limit of frontend editing, that you can only edit what is visible as content. We have been discussing the idea of a metadata editor. It should be possible to write a plugin that triggers when you select an item of the Page type and shows a button in the toolbar to edit meta data. You would need to provide the additional meta data in the page, next to the other attributes and content. But I am not aware of any implementation or concrete example how this would be done exactly. If you end up doing this, it would be great if you can contribute your findings to the symfony-cmf-docs.