Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/src/ContentBundle/Admin/
Upload File :
Current File : /var/www/v3.cesa.co.za/src/ContentBundle/Admin/FormTypeAdmin.php

<?php

namespace App\ContentBundle\Admin;

use Knp\Menu\ItemInterface as MenuItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;
use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage;

/**
 * Form Type Admin
 *
 * @author Otto Saayman <otto@igotafrica.com>
 * @package ContentBundle
 * @subpackage Admin
 * @version 0.0.1
 */
class FormTypeAdmin extends AbstractAdmin {

    /**
     * Security Context
     * @var \Symfony\Component\Security\Core\SecurityContextInterface
     */
    protected $securityContext;

    /**
     * Entity manager
     * @var \Doctrine\ORM\EntityManager
     */
    protected $em;
    protected function generateBaseRouteName(bool $isChildAdmin = false): string
    {
        return 'form_type';
    }

    protected function generateBaseRoutePattern(bool $isChildAdmin = false): string
    {
        return 'form_type';
    }

    public function setSecurityContext(UsageTrackingTokenStorage $securityContext) {
        $this->securityContext = $securityContext;
    }

    /**
     * @param \Doctrine\ORM\EntityManager $em
     */
    public function setEntityManager($em) {
        $this->em = $em;
    }

    protected function configureFormFields(FormMapper $formMapper): void {
        $formMapper
                ->add('type_name')
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper): void {
        $datagridMapper
                ->add('type_name')
        ;
    }

    protected function configureListFields(ListMapper $listMapper): void {
        $listMapper
                ->addIdentifier('type_name')
                ->add('mime_type')
                ->add('_action', 'actions', array(
                    'actions' => array(
                        'show' => array(),
                        'edit' => array(),
                        'delete' => array(),
                    )
                ))
        ;
    }

    protected function configureShowFields(ShowMapper $showMapper): void {
        $showMapper
                ->add('type_name')
        ;
    }
}