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

Commit ad55fa0

Browse files
committed
Merge branch 'dev'
2 parents c4d2440 + 2390532 commit ad55fa0

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

bundles/routing/dynamic.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,76 @@ configuration in the ``sonata_admin`` section of your project configuration:
614614
615615
See the `Sonata Admin extension documentation`_ for more information.
616616

617+
FrontendLink Sonata Admin Extension
618+
-----------------------------------
619+
620+
This bundle provides an extension to show a button in Sonata Admin, which links on the actual
621+
frontend representation of a document. Documents which implement the ``RouteReferrersReadInterface``
622+
and Routes itself (``Symfony\Component\Routing\Route``) are supported.
623+
624+
To enable the extension in your admin classes, simply define the extension
625+
configuration in the ``sonata_admin`` section of your project configuration:
626+
627+
.. configuration-block::
628+
629+
.. code-block:: yaml
630+
631+
# app/config/config.yml
632+
sonata_admin:
633+
# ...
634+
extensions:
635+
cmf_routing.admin_extension.frontend_link:
636+
implements:
637+
- Symfony\Cmf\Component\Routing\RouteReferrersReadInterface
638+
extends:
639+
- Symfony\Component\Routing\Route
640+
641+
.. code-block:: xml
642+
643+
<!-- app/config/config.xml -->
644+
<config xmlns="http://sonata-project.org/schema/dic/admin">
645+
<!-- ... -->
646+
<extension id="cmf_routing.admin_extension.frontend_link">
647+
<implement>Symfony\Cmf\Component\Routing\RouteReferrersReadInterface</implement>
648+
<extend>Symfony\Component\Routing\Route</extend>
649+
</extension>
650+
</config>
651+
652+
.. code-block:: php
653+
654+
// app/config/config.php
655+
$container->loadFromExtension('sonata_admin', array(
656+
'extensions' => array(
657+
'cmf_routing.admin_extension.frontend_link' => array(
658+
'implements' => array(
659+
'Symfony\Cmf\Component\Routing\RouteReferrersReadInterface',
660+
),
661+
'extends' => array(
662+
'Symfony\Component\Routing\Route',
663+
),
664+
),
665+
),
666+
));
667+
668+
See the `Sonata Admin extension documentation`_ for more information.
669+
670+
Styling
671+
~~~~~~~
672+
673+
Feel free to use your own styles. The frontend link button can be customized
674+
using the following example CSS rules:
675+
676+
.. code-block:: css
677+
678+
.sonata-admin-menu-item a.sonata-admin-frontend-link {
679+
font-weight: bold;
680+
}
681+
682+
.sonata-admin-menu-item a.sonata-admin-frontend-link:before {
683+
font-family: FontAwesome;
684+
content: "\f08e";
685+
}
686+
617687
Customize the DynamicRouter
618688
---------------------------
619689

0 commit comments

Comments
 (0)