コード例 #1
0
 /**
  * Chargement du template de formulaire.
  *
  * @access protected
  * @return string
  *
  * @author (c) Etienne de Longeaux <*****@*****.**>
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     //$choiceList        = $this->_em->getRepository('SfynxCmfBundle:Widget')->findBy(array('block'=>null));
     $choiceList = $this->_em->getRepository('SfynxCmfBundle:Widget')->getAllSnippet(1, "ASC");
     $result = array();
     if (is_array($choiceList)) {
         foreach ($choiceList as $key => $field) {
             $result[$field->getId()] = $field->getConfigCssClass();
         }
     }
     $builder->add('choice', 'choice', array('choices' => array("insert" => "Insert", "create" => "Create"), 'data' => "insert", 'required' => false, 'multiple' => false, 'expanded' => true, 'label' => "pi.form.label.field.choice", "label_attr" => array("class" => "select_choice")))->add('id_snippet', 'choice', array('choices' => $result, 'multiple' => false, 'required' => true, 'empty_value' => 'pi.form.label.select.choose.block', "attr" => array("class" => "pi_simpleselect"), "label_attr" => array("class" => "insert_collection"), 'label' => 'Liste des blocs métier'))->add('configCssClass', 'text', array('label' => 'Class Name / Snippet Name', 'required' => true, "label_attr" => array("class" => "snippet_collection")))->add('plugin', 'choice', array('choices' => PiWidgetExtension::getAvailableWidgetPlugins(), 'required' => true, 'multiple' => false, 'expanded' => false, "label_attr" => array("class" => "snippet_collection")))->add('action', 'text', array('required' => true, "label_attr" => array("class" => "snippet_collection")))->add('configXml', 'textarea', array('data' => PiWidgetExtension::getDefaultConfigXml(), 'required' => true, "label_attr" => array("class" => "snippet_collection")));
 }
コード例 #2
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled'))->add('secure', 'checkbox', array('label' => 'pi.page.form.secure', 'required' => false))->add('heritage', 'sfynx_security_roles', array('multiple' => true, 'required' => false, 'label' => 'pi.page.form.heritage', "attr" => array("class" => "pi_multiselect")))->add('configCssClass', 'text', array('label' => 'Class Name / Snippet Name'))->add('plugin', 'choice', array('choices' => PiWidgetExtension::getAvailableWidgetPlugins(), 'required' => true, 'multiple' => false, 'expanded' => false))->add('action')->add('configXml', 'textarea', array())->add('position')->add('translations', 'collection', array('allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => true, 'type' => new TranslationWidgetType($this->_container), 'options' => array('attr' => array('class' => 'translation_widget')), 'label' => ' '));
     $builder->add('cacheable', 'checkbox', array('label' => 'pi.page.form.cacheable', 'required' => false, 'help_block' => 'pi.page.form.field.cacheable', "label_attr" => array("class" => "widget_httpcache")))->add('public', 'checkbox', array('label' => 'pi.page.form.public', 'required' => false, 'help_block' => 'pi.page.form.field.public', "label_attr" => array("class" => "widget_httpcache")))->add('lifetime', 'number', array('label' => 'pi.page.form.lifetime', 'required' => false, 'help_block' => 'pi.page.form.field.lifetime', "label_attr" => array("class" => "widget_httpcache")))->add('cacheTemplating', 'choice', array('choices' => \Sfynx\CmfBundle\Repository\WidgetRepository::getAvailableCacheTemplating(), 'label' => 'pi.widget.form.cachetemplating', 'required' => true, 'multiple' => false, 'expanded' => true, "label_attr" => array("class" => "widget_behavior widget_cachetemplating")))->add('sluggify', 'choice', array('choices' => \Sfynx\CmfBundle\Repository\WidgetRepository::getAvailableSluggify(), 'label' => 'pi.widget.form.sluggify', 'required' => true, 'multiple' => false, 'expanded' => true, "label_attr" => array("class" => "widget_behavior widget_sluggify")))->add('ajax', 'choice', array('choices' => \Sfynx\CmfBundle\Repository\WidgetRepository::getAvailableAjax(), 'label' => 'pi.widget.form.ajax', 'required' => true, 'multiple' => false, 'expanded' => true, "label_attr" => array("class" => "widget_behavior widget_ajax")));
 }