|
13 years ago | |
---|---|---|
Admin | 13 years ago | |
Builder | 13 years ago | |
Command | 14 years ago | |
Controller | 13 years ago | |
Datagrid | 13 years ago | |
DependencyInjection | 13 years ago | |
Filter | 13 years ago | |
Form | 13 years ago | |
Guesser | 13 years ago | |
Model | 13 years ago | |
Resources | 13 years ago | |
Route | 13 years ago | |
Security | 13 years ago | |
Show | 14 years ago | |
Tests | 13 years ago | |
Twig | 13 years ago | |
Util | 14 years ago | |
Validator | 13 years ago | |
.gitignore | 14 years ago | |
CHANGES | 13 years ago | |
CREDITS | 14 years ago | |
LICENSE | 14 years ago | |
README.md | 13 years ago | |
SonataAdminBundle.php | 13 years ago | |
phpunit.xml.dist | 14 years ago |
The documentation of the bundle is in Resources/doc
.
Warning: documentation files are not rendering correctly in Github (reStructuredText format) and some content might be broken or hidden, make sure to read raw files.
Defining an Admin
class is pretty easy: simply define configure[Show|Form|List|Datagrid]Fields
methods
<?php
namespace Sonata\NewsBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
class PostAdmin extends Admin
{
public function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('author')
->add('enabled')
->add('title')
->add('abstract')
->add('content')
->add('tags')
;
}
public function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('enabled', null, array('required' => false))
->add('author', 'sonata_type_model', array(), array('edit' => 'list'))
->add('title')
->add('abstract')
->add('content')
->end()
->with('Tags')
->add('tags', 'sonata_type_model', array('expanded' => true))
->end()
->with('Options', array('collapsed' => true))
->add('commentsCloseAt')
->add('commentsEnabled', null, array('required' => false))
->end()
;
}
public function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title')
->add('author')
->add('enabled')
->add('tags')
->add('commentsEnabled')
;
}
public function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
->add('enabled')
->add('tags', null, array('filter_field_options' => array('expanded' => true, 'multiple' => true)))
}
}
Screenshots : http://www.dropbox.com/gallery/581816/2/BaseApplicationBundle/preview?h=59b2e8
Of course, power users will be happy as an Admin
class is very flexible as all dependencies are
injected by the DIC.
Dashboard
List
Edit/Create
Templating
Others