Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions bundles/menu/sonata_admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,108 @@ configuration in the ``sonata_admin`` section of your project configuration:

See the `Sonata Admin extension documentation`_ for more information.

MenuOptionInterface Sonata Admin Extension
-------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

the tag line (the line containing -) should be as long as the headline (the line containing the text of the headline). In this case, you have to remove some -'s.

Copy link
Author

Choose a reason for hiding this comment

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

I don't know exactly what you mean but I'll remove it :)


This bundle provides an extension that allows user to edit different menu options using the Sonata admin interface.
Copy link
Member

Choose a reason for hiding this comment

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

You should wrap lines after the first word that crosses the 72th character.


To enable the extensions in your admin classes, simply define the extension configuration in the ``sonata_admin`` section of your project configuration:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
sonata_admin:
# ...
extensions:
cmf_menu.admin_extension.menu_options:
implements:
- Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://cmf.symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<config xmlns="http://sonata-project.org/schema/dic/admin">
<!-- ... -->
<extension id="cmf_menu.admin_extension.menu_options">
<implement>Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface</implement>
</extension>
</config>
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('sonata_admin', array(
'extensions' => array(
'cmf_menu.admin_extension.menu_options' => array(
'implements' => array(
'Symfony\Cmf\Bundle\MenuBundle\Model\MenuOptionsInterface',
),
),
),
));

See the `Sonata Admin extension documentation`_ for more information.

These are the list of available options:

Display
Display children
Menu attributes (advanced)
Label attributes (advanced)
Children attributes (advanced)
Link attributes (advanced)

See the `KnpMenuBundle documentation`_ for more information about these attributes.

By default the only available options are **Display** and **Display Children**. To enable the advaned options you need to add ``burgov/key-value-form-bundle`` requirement in your ``composer.json`` and enable the advanced options in your config file:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
cmf_menu:
admin_extensions:
menu_options:
advanced: true
Copy link
Member

Choose a reason for hiding this comment

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

this should also have an XML and PHP example:

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://cmf.symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <config xmlns="http://cmf.symfony.com/schema/dic/menu">
        <admin-extensions>
            <menu-options advanced="true">
        </admin-extensions>
    </config>

</container>

PHP:

// app/config/config.php
$container->loadFromExtension('cmf_menu', array(
    'admin_extensions' => array(
        'menu_options' => array(
            'advanced' => true,
        ),
    ),
));



.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://cmf.symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<config xmlns="http://cmf.symfony.com/schema/dic/menu">
<admin-extensions>
<menu-options advanced="true">
</admin-extensions>
</config>

</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('cmf_menu', array(
'admin_extensions' => array(
'menu_options' => array(
'advanced' => true,
),
),
));

.. _`Sonata Admin extension documentation`: http://sonata-project.org/bundles/admin/master/doc/reference/extensions.html
.. _SonataDoctrinePHPCRAdminBundle: http://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/index.html
.. _`configuring sonata admin`: http://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/configuration.html
.. _`KnpMenuBundle documentation`: http://github.com/KnpLabs/KnpMenu/blob/master/doc/01-Basic-Menus.markdown#menu-attributes