|
14 jaren geleden | |
---|---|---|
Admin | 14 jaren geleden | |
Builder | 14 jaren geleden | |
Command | 14 jaren geleden | |
Controller | 14 jaren geleden | |
Datagrid | 14 jaren geleden | |
DependencyInjection | 14 jaren geleden | |
Filter | 14 jaren geleden | |
Form | 14 jaren geleden | |
Guesser | 14 jaren geleden | |
Model | 14 jaren geleden | |
Resources | 14 jaren geleden | |
Route | 14 jaren geleden | |
Security | 14 jaren geleden | |
Show | 14 jaren geleden | |
Tests | 14 jaren geleden | |
Twig | 14 jaren geleden | |
Util | 14 jaren geleden | |
Validator | 14 jaren geleden | |
.gitignore | 14 jaren geleden | |
CHANGES | 14 jaren geleden | |
CREDITS | 14 jaren geleden | |
LICENSE | 14 jaren geleden | |
README.md | 14 jaren geleden | |
SonataAdminBundle.php | 14 jaren geleden | |
phpunit.xml.dist | 14 jaren geleden |
There is online documentation here:
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
There is online documentation here:
If you want to contribute to this documentation, you need to go to the Resources/doc
folder where
the reStructuredText documentation is available.
Please note the Github preview might break and hide some content.
Usage examples