Admin/MenuAdmin.php
protected function configureFormFields(FormMapper $formMapper)
    {
        if ($this->getSubject() && $this->getSubject()->getId()) {
            $this->initializeEditForm();
        } else {
            $this->initializeCreateForm();
        }

        $formMapper
             ->add('name', 'text')
             ->add('page', PageSelectorType::class, array(
                        'site'          => $this->siteInstance,
                        'model_manager' => $this->getModelManager(),
                        'class'         => 'Application\Sonata\PageBundle\Entity\Page',
                        'required'      => true
             ), array(
                        'admin_code' => 'sonata.page.admin.page',
                        'link_parameters' => array(
                            'siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null
                        )
                    ))
             ->add('parent', 'sonata_type_model', array('required' => false))
             ->add('active', 'checkbox', array('required' => false, 'attr' => $this->formAttribute))
             ->add('clickable', 'checkbox', array('required' => false, 'attr' => $this->formAttribute))
            ;
    }
protected function configureFormFields(FormMapper $formMapper)
    {
        if ($this->getSubject() && $this->getSubject()->getId()) {
            $this->initializeEditForm();
        } else {
            $this->initializeCreateForm();
        }

        $formMapper
             ->add('name', 'text')
             ->add('page', PageSelectorType::class, array(
                        'site'          => $this->siteInstance,
                        'model_manager' => $this->getModelManager(),
                        'class'         => 'Application\Sonata\PageBundle\Entity\Page',
                        'required'      => true
             ), array(
                        'admin_code' => 'sonata.page.admin.page',
                        'link_parameters' => array(
                            'siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null
                        )
                    ))
             ->add('parent', 'sonata_type_model', array('required' => false))
             ->add('active', 'checkbox', array('required' => false, 'attr' => $this->formAttribute))
             ->add('clickable', 'checkbox', array('required' => false, 'attr' => $this->formAttribute))
            ;
    }
@param \Sonata\AdminBundle\Form\FormMapper $formMapper

@return void