12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- /*
- * This file is part of the Sonata package.
- *
- * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\UserBundle\Admin\Model;
- use Sonata\AdminBundle\Admin\Admin;
- use Sonata\AdminBundle\Form\FormMapper;
- use Sonata\AdminBundle\Datagrid\DatagridMapper;
- use Sonata\AdminBundle\Datagrid\ListMapper;
- class GroupAdmin extends Admin
- {
- protected $formOptions = array(
- 'validation_groups' => 'Registration'
- );
- /**
- * {@inheritdoc}
- */
- public function getNewInstance()
- {
- $class = $this->getClass();
- return new $class('', array());
- }
- /**
- * {@inheritdoc}
- */
- protected function configureListFields(ListMapper $listMapper)
- {
- $listMapper
- ->addIdentifier('name')
- ->add('roles')
- ;
- }
- /**
- * {@inheritdoc}
- */
- protected function configureDatagridFilters(DatagridMapper $datagridMapper)
- {
- $datagridMapper
- ->add('name')
- ;
- }
- /**
- * {@inheritdoc}
- */
- protected function configureFormFields(FormMapper $formMapper)
- {
- $formMapper
- ->add('name')
- ->add('roles', 'sonata_security_roles', array(
- 'expanded' => true,
- 'multiple' => true,
- 'required' => false
- ))
- ;
- }
- }
|