Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
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
108 changes: 108 additions & 0 deletions bundles/menu/sonata_admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,114 @@ configuration in the ``sonata_admin`` section of your project configuration:

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

MenuOptionInterface Sonata Admin Extension
------------------------------------------

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

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


.. 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
8 changes: 7 additions & 1 deletion bundles/simple_cms/menus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Menus
-----

You can use `Knp Menu Bundle`_ to render a menu of your SimpleCms pages. The default Page document
You can use `Knp Menu Bundle`_ to render a menu of your SimpleCms pages. The default Page document
(``Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page``) implements the ``Knp\Menu\NodeInterface``
which allows for rendering them as a menu.

Expand Down Expand Up @@ -41,4 +41,10 @@ setDisplay($display)
setDisplayChildren($displayChildren)
Boolean which determines whether children should be added to the menu

.. tip::

If you use Sonata Admin in your project you can edit the menu options
using the MenuOptionsExtension that comes with the menu bundle. For more
information on how to use it take a look at the :doc:`menu bundle documentation <../menu/sonata_admin>`

.. _`Knp Menu Bundle`: https://github.com/KnpLabs/KnpMenuBundle
62 changes: 62 additions & 0 deletions reference/configuration/menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,68 @@ admin_recursive_breadcrumbs

When editing a node, this setting will cause the Sonata admin breadcrumb to include ancestors of the node being edited.

Admin Extensions
----------------

The ``admin_extensions`` section contains the configurations of the admin extensions that comes with the menu bundle.

menu_options
~~~~~~~~~~~~

You can configure the menu options extension in this sections.

.. configuration-block::

.. code-block:: yaml

cmf_menu:
# ...
cmf_menu:
admin_extensions:
menu_options:
enabled: auto
advanced: false

.. code-block:: xml

<?xml version="1.0" charset="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">
<config xmlns="http://cmf.symfony.com/schema/dic/menu">
<admin_extensions>
<menu_options
enabled="auto"
advanced="false"
/>
</admin_extensions>
</config>
</container>

.. code-block:: php

$container->loadFromExtension('cmf_menu', array(
'admin_extensions' => array(
'menu_options' => array(
'enabled' => 'auto',
'advanced' => false,
),
),
),
));

enabled
"""""""
**type**: ``enum`` **valid values**: ``true|false|auto`` **default**: ``auto``

If ``true``, the admin extension is activated. If set to ``auto``, it will be
activated only if the SonataAdminBundle is present.

advanced
""""""""
**type**: ``boolean`` **default**: ``false``

if set to ``true`` it will expose the advanced options in the admin.
To enable this options you need ``BurgovKeyValueFormBundle``

Voter
-----

Expand Down