forked from symfony-cmf/blog-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlogAdmin.php
72 lines (63 loc) · 1.78 KB
/
BlogAdmin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2014 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Cmf\Bundle\BlogBundle\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;
/**
* Blog Admin
*
* @author Daniel Leech <[email protected]>
*/
class BlogAdmin extends Admin
{
protected $translationDomain = 'CmfBlogBundle';
protected $blogRoot;
/**
* Constructor
*
* @param string $code
* @param string $class
* @param string $baseControllerName
* @param string $blogRoot
*/
public function __construct($code, $class, $baseControllerName, $blogRoot)
{
parent::__construct($code, $class, $baseControllerName);
$this->blogRoot = $blogRoot;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('dashboard.label_blog')
->add('name', 'text')
->add('description', 'textarea')
->add('parentDocument', 'doctrine_phpcr_odm_tree', array(
'root_node' => $this->blogRoot,
'choice_list' => array(),
'select_root_node' => true,
))
->end()
;
}
protected function configureDatagridFilters(DatagridMapper $filterMapper)
{
$filterMapper
->add('name', 'doctrine_phpcr_string')
;
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
;
}
}