1 | <?php |
||
26 | class ContentAdmin extends Admin |
||
27 | { |
||
28 | /** |
||
29 | * @var ManagerRegistry |
||
30 | */ |
||
31 | private $managerRegistry; |
||
32 | |||
33 | public function setManagerRegistry(ManagerRegistry $managerRegistry) |
||
37 | |||
38 | public function getExportFormats() |
||
42 | |||
43 | public function toString($object) |
||
49 | |||
50 | protected function configureListFields(ListMapper $listMapper) |
||
56 | |||
57 | protected function configureFormFields(FormMapper $formMapper) |
||
58 | { |
||
59 | $formMapper |
||
60 | ->with('form.group_general') |
||
61 | ->add('name', 'Symfony\Component\Form\Extension\Core\Type\TextType') |
||
62 | ->add('title', 'Symfony\Component\Form\Extension\Core\Type\TextType') |
||
63 | ->add( |
||
64 | 'children', |
||
65 | 'Sonata\CoreBundle\Form\Type\CollectionType', |
||
66 | array('label' => false, 'type_options' => array('delete' => true, 'delete_options' => array('type' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', 'type_options' => array('required' => false, 'mapped' => false)))), |
||
67 | array('edit' => 'inline', 'inline' => 'table', 'admin_code' => 'sonata_admin_doctrine_phpcr.test.admin') |
||
68 | ) |
||
69 | ->add( |
||
70 | 'routes', |
||
71 | 'Sonata\AdminBundle\Form\Type\ModelType', |
||
72 | array('property' => 'title', 'multiple' => true, 'expanded' => false) |
||
73 | ) |
||
74 | ->add('parentDocument', 'Symfony\Cmf\Bundle\TreeBrowserBundle\Form\Type\TreeSelectType', array( |
||
75 | 'widget' => 'browser', |
||
76 | 'root_node' => $this->getRootPath(), |
||
77 | )) |
||
78 | ->add( |
||
79 | 'child', |
||
80 | 'Sonata\AdminBundle\Form\Type\ModelType', |
||
81 | array('property' => 'title', 'class' => 'Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\Document\Content', 'btn_catalogue' => 'List') |
||
82 | ) |
||
83 | ->add('singleRoute', 'Symfony\Cmf\Bundle\TreeBrowserBundle\Form\Type\TreeSelectType', array( |
||
84 | 'widget' => 'browser', |
||
85 | 'root_node' => $this->getRootPath(), |
||
86 | )) |
||
87 | ->end(); |
||
88 | |||
89 | $formMapper->getFormBuilder()->get('parentDocument')->addModelTransformer(new DocumentToPathTransformer( |
||
90 | $this->managerRegistry->getManagerForClass($this->getClass()) |
||
91 | )); |
||
92 | |||
93 | $formMapper->getFormBuilder()->get('singleRoute')->addModelTransformer(new DocumentToPathTransformer( |
||
94 | $this->managerRegistry->getManagerForClass($this->getClass()) |
||
95 | )); |
||
96 | } |
||
97 | |||
98 | protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||
104 | |||
105 | public function configureShowFields(ShowMapper $showMapper) |
||
126 | } |
||
127 |