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

Added documentation for Sonata FrontendLinkExtension #610

Merged
merged 3 commits into from
Nov 15, 2014
Merged
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
70 changes: 70 additions & 0 deletions bundles/routing/dynamic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,76 @@ configuration in the ``sonata_admin`` section of your project configuration:

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

FrontendLink Sonata Admin Extension
-----------------------------------

This bundle provides an extension to show a button in Sonata Admin, which links on the actual
frontend representation of a document. Documents which implement the ``RouteReferrersReadInterface``
and Routes itself (``Symfony\Component\Routing\Route``) are supported.

To enable the extension 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_routing.admin_extension.frontend_link:
implements:
- Symfony\Cmf\Component\Routing\RouteReferrersReadInterface
Copy link
Member

Choose a reason for hiding this comment

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

can you please add

extends:
    - Symfony\Component\Routing\Route 

here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done...

extends:
- Symfony\Component\Routing\Route

.. code-block:: xml

<!-- app/config/config.xml -->
<config xmlns="http://sonata-project.org/schema/dic/admin">
<!-- ... -->
<extension id="cmf_routing.admin_extension.frontend_link">
<implement>Symfony\Cmf\Component\Routing\RouteReferrersReadInterface</implement>
<extend>Symfony\Component\Routing\Route</extend>
</extension>
</config>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('sonata_admin', array(
'extensions' => array(
'cmf_routing.admin_extension.frontend_link' => array(
'implements' => array(
'Symfony\Cmf\Component\Routing\RouteReferrersReadInterface',
),
'extends' => array(
'Symfony\Component\Routing\Route',
),
),
),
));

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

Styling
~~~~~~~

Feel free to use your own styles. The frontend link button can be customized
using the following example CSS rules:

.. code-block:: css

.sonata-admin-menu-item a.sonata-admin-frontend-link {
font-weight: bold;
}

.sonata-admin-menu-item a.sonata-admin-frontend-link:before {
font-family: FontAwesome;
content: "\f08e";
}

Customize the DynamicRouter
---------------------------

Expand Down