Permalink
Browse files

added admin classes for slideshow

  • Loading branch information...
1 parent 15103ad commit a6c9f562c19cfb4fa4f25b0db2ef01dc1070444e @elHornair elHornair committed Feb 19, 2013
Showing with 96 additions and 0 deletions.
  1. +41 −0 Admin/SlideshowAdmin.php
  2. +20 −0 Admin/SlideshowItemAdmin.php
  3. +35 −0 Resources/config/admin.xml
View
@@ -0,0 +1,41 @@
+<?php
+
+namespace Symfony\Cmf\Bundle\BlockBundle\Admin;
+
+use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+
+class SlideshowAdmin extends Admin
+{
+
+ protected function configureListFields(ListMapper $listMapper)
+ {
+ parent::configureListFields($listMapper);
+ $listMapper
+ ->addIdentifier('path', 'text')
+ ->add('title', 'text');
+ }
+
+ protected function configureFormFields(FormMapper $formMapper)
+ {
+ parent::configureFormFields($formMapper);
+ $formMapper
+ ->with('form.group_general')
+ ->add('title', 'text')
+ ->with('Items')
+ ->add('children', 'sonata_type_collection',
+ array(
+ 'by_reference' => false
+ ),
+ array(
+ 'edit' => 'inline',
+ 'inline' => 'table',
+ 'admin_code' => 'symfony_cmf_block.slideshow_item_admin'
+ ))
+ ->end();
+ }
+
+ // TODO: Deletion doesn't work yet
+
+}
@@ -0,0 +1,20 @@
+<?php
+
+namespace Symfony\Cmf\Bundle\BlockBundle\Admin;
+
+use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;
+use Sonata\AdminBundle\Form\FormMapper;
+
+class SlideshowItemAdmin extends Admin
+{
+
+ protected function configureFormFields(FormMapper $formMapper)
+ {
+ parent::configureFormFields($formMapper);
+ $formMapper
+ ->with('form.group_general')
+ ->add('label', 'text')
+ ->end();
+ }
+
+}
View
@@ -7,6 +7,10 @@
<parameters>
<parameter key="symfony_cmf_block.simple_admin_class">Symfony\Cmf\Bundle\BlockBundle\Admin\SimpleBlockAdmin</parameter>
<parameter key="symfony_cmf_block.simple_document_class">Symfony\Cmf\Bundle\BlockBundle\Document\SimpleBlock</parameter>
+ <parameter key="symfony_cmf_block.slideshow_admin_class">Symfony\Cmf\Bundle\BlockBundle\Admin\SlideshowAdmin</parameter>
+ <parameter key="symfony_cmf_block.slideshow_document_class">Symfony\Cmf\Bundle\BlockBundle\Document\SlideshowBlock</parameter>
+ <parameter key="symfony_cmf_block.slideshow_item_admin_class">Symfony\Cmf\Bundle\BlockBundle\Admin\SlideshowItemAdmin</parameter>
+ <parameter key="symfony_cmf_block.slideshow_item_document_class">Symfony\Cmf\Bundle\BlockBundle\Document\SlideshowItemBlock</parameter>
</parameters>
<services>
@@ -24,5 +28,36 @@
<argument>%symfony_cmf_block.content_basepath%</argument>
</call>
</service>
+
+ <service id="symfony_cmf_block.slideshow_admin" class="%symfony_cmf_block.slideshow_admin_class%">
+ <tag name="sonata.admin" manager_type="doctrine_phpcr" group="dashboard.group_content" label_catalogue="SymfonyCmfBlockBundle" label="dashboard.label_slideshow_block" label_translator_strategy="sonata.admin.label.strategy.underscore" />
+ <argument/>
+ <argument>%symfony_cmf_block.slideshow_document_class%</argument>
+ <argument>SonataAdminBundle:CRUD</argument>
+
+ <call method="setRouteBuilder">
+ <argument type="service" id="sonata.admin.route.path_info_slashes" />
+ </call>
+
+ <call method="setRoot">
+ <argument>%symfony_cmf_block.content_basepath%</argument>
+ </call>
+ </service>
+
+ <service id="symfony_cmf_block.slideshow_item_admin" class="%symfony_cmf_block.slideshow_item_admin_class%">
+ <tag name="sonata.admin" manager_type="doctrine_phpcr" group="dashboard.group_content" label_catalogue="SymfonyCmfBlockBundle" label="dashboard.label_slideshow_item_block" label_translator_strategy="sonata.admin.label.strategy.underscore" />
+ <argument/>
+ <argument>%symfony_cmf_block.slideshow_item_document_class%</argument>
+ <argument>SonataAdminBundle:CRUD</argument>
+
+ <call method="setRouteBuilder">
+ <argument type="service" id="sonata.admin.route.path_info_slashes" />
+ </call>
+
+ <call method="setRoot">
+ <argument>%symfony_cmf_block.content_basepath%</argument>
+ </call>
+ </service>
+
</services>
</container>

0 comments on commit a6c9f56

Please sign in to comment.