/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); $propertiesForm = $builder->create('properties', 'form')->add('url', 'text', ['label' => 'label.url'])->add('target', 'choice', ['label' => 'label.target', 'choices' => ['_blank' => '_blank', '_self' => '_self'], 'required' => false])->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]); if ($this->styles) { $propertiesForm->add('styles', 'choice', ['label' => 'label.styling', 'choices' => array_combine($this->styles, $this->styles), 'required' => false, 'expanded' => true, 'multiple' => true]); } $builder->add($builder->create('default', 'form', ['inherit_data' => true])->add('value', 'text', ['label' => 'label.label']))->add($propertiesForm); }
/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); $propertiesForm = $builder->create('properties', 'form')->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]); if ($this->styles) { $propertiesForm->add('styles', 'choice', ['label' => 'label.styling', 'choices' => array_combine($this->styles, $this->styles), 'required' => false, 'expanded' => true, 'multiple' => true, 'attr' => ['help_text' => 'help.html_styles']]); } $builder->add($builder->create('default', 'form', ['inherit_data' => true])->add('media', 'mediapicker', ['required' => false, 'multiple' => false, 'property' => 'name', 'class' => 'OpiferCmsBundle:Media'])->add('value', 'ckeditor', ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]]))->add($propertiesForm); }
/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); $propertiesForm = $builder->create('properties', 'form')->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]); $builder->add($propertiesForm); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $block = $event->getData(); $form = $event->getForm(); if ($block->getWrapper() == 'section') { $styles = ['row-space-top-2', 'row-space-top-4', 'row-space-top-8', 'row-space-2', 'row-space-4', 'row-space-8', 'light', 'dark']; $form->get('properties')->add('styles', 'choice', ['label' => 'label.styling', 'choices' => array_combine($styles, $styles), 'required' => false, 'expanded' => true, 'multiple' => true, 'attr' => ['help_text' => 'help.html_styles']]); } $form->get('properties')->add('container_size', 'choice', ['label' => 'label.container_sizing', 'choices' => ['fluid' => 'label.container_fluid', '' => 'label.container_fixed', 'smooth' => 'label.container_smooth'], 'required' => true, 'attr' => ['help_text' => 'help.container_sizing']]); }); }
/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); $propertiesForm = $builder->create('properties', 'form')->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]); $builder->add($propertiesForm); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $block = $event->getData(); $form = $event->getForm(); $styles = ['row-space-top-2', 'row-space-top-4', 'row-space-top-8', 'row-space-2', 'row-space-4', 'row-space-8']; $form->get('properties')->add('styles', 'choice', ['label' => 'label.styling', 'choices' => array_combine($styles, $styles), 'required' => false, 'expanded' => true, 'multiple' => true, 'attr' => ['help_text' => 'help.html_styles']]); // @todo: Replace with a nice getDefaultOptions method $properties = $block->getProperties(); if (!isset($properties['styles'])) { $properties['styles'] = array(); } $block->setProperties($properties); $form->get('properties')->add('spans', 'span_collection', ['column_count' => $block->getColumnCount(), 'label' => 'label.spans', 'attr' => ['help_text' => 'help.column_spans']]); $form->get('properties')->add('gutters', 'gutter_collection', ['column_count' => $block->getColumnCount(), 'label' => 'label.gutters', 'attr' => ['help_text' => 'help.column_gutters']]); }); }
/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); // Default panel $builder->add($builder->create('default', 'form', ['inherit_data' => true])->add('value', 'ckeditor', ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]]))->add($builder->create('properties', 'form')->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']])); }
/** * {@inheritdoc} */ public function buildManageForm(FormBuilderInterface $builder, array $options) { parent::buildManageForm($builder, $options); // Default panel $builder->add($builder->create('default', 'form', ['virtual' => true])->add('media', 'mediapicker', ['required' => false, 'multiple' => false, 'property' => 'name', 'class' => 'OpiferCmsBundle:Media']))->add($builder->create('properties', 'form')->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']])); }