예제 #1
0
 public function buildForm(FormBuilderInterface $builder, array $options = array())
 {
     $builder->add('name', null, array('label' => 'form.menu_name', 'translation_domain' => 'GloryMenuBundle'))->add('label', null, array('label' => 'form.menu_label', 'translation_domain' => 'GloryMenuBundle'));
     switch ($options['type']) {
         case 'root':
             $builder->add('template', null, array('label' => 'form.menu_template', 'translation_domain' => 'GloryMenuBundle'));
             break;
         default:
             $menuRoot = $options['data']->getRoot();
             $choice = $this->generateChildrenChoice($menuRoot);
             $builder->add('uri', null, array('label' => 'form.menu_uri', 'translation_domain' => 'GloryMenuBundle'));
             $builder->add('icon', null, array('label' => 'form.menu_icon', 'translation_domain' => 'GloryMenuBundle'));
             $builder->add('parent', 'entity', array('class' => $this->menuManager->getClass(), 'property' => 'treename', 'choices' => $choice, 'label' => 'form.menu_parent', 'translation_domain' => 'GloryMenuBundle'));
             break;
     }
 }
예제 #2
0
 /**
  * @param OptionsResolverInterface $resolver
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->menuManager->getClass()));
 }