/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /* get the metadata associate */ /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; /** @var FieldType $fieldType */ foreach ($fieldType->getChildren() as $fieldType) { if (!$fieldType->getDeleted()) { /* merge the default options with the ones specified by the user */ $options = array_merge(['metadata' => $fieldType, 'label' => false], $fieldType->getDisplayOptions()); $builder->add('ems_' . $fieldType->getName(), $fieldType->getType(), $options); } } }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /* get the metadata associate */ /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; /** @var FieldType $fieldType */ foreach ($fieldType->getChildren() as $fieldType) { if (!$fieldType->getDeleted()) { /* merge the default options with the ones specified by the user */ $options = array_merge(['metadata' => $fieldType, 'label' => false], $fieldType->getDisplayOptions()); $builder->add('ems_' . $fieldType->getName(), $fieldType->getType(), $options); } } $builder->add('remove_collection_item', SubmitEmsType::class, ['attr' => ['class' => 'btn-danger btn-sm remove-content-button'], 'label' => 'Remove', 'icon' => 'fa fa-trash']); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $choices = []; $values = explode("\n", str_replace("\r", "", $options['choices'])); $labels = explode("\n", str_replace("\r", "", $options['labels'])); foreach ($values as $id => $value) { if (isset($labels[$id])) { $choices[$labels[$id]] = $value; } else { $choices[$value] = $value; } } $builder->add($options['multiple'] ? 'array_text_value' : 'text_value', ChoiceType::class, ['label' => isset($options['label']) ? $options['label'] : $fieldType->getName(), 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole()), 'choices' => $choices, 'empty_data' => null, 'multiple' => $options['multiple'], 'expanded' => $options['expanded']]); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $builder->add('text_value', TextareaType::class, ['attr' => ['rows' => $options['rows']], 'label' => null != $options['label'] ? $options['label'] : $fieldType->getName(), 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole())]); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $builder->add('float_value', NumberType::class, ['label' => isset($options['label']) ? $options['label'] : $fieldType->getName(), 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole())]); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /* get the metadata associate */ /** @var FieldType $fieldType */ $fieldType = clone $builder->getOptions()['metadata']; $builder->add('ems_' . $fieldType->getName(), CollectionType::class, array('entry_type' => CollectionItemFieldType::class, 'entry_options' => $options, 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'entry_options' => ['metadata' => $fieldType, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole())]))->add('add_nested', SubmitEmsType::class, ['attr' => ['class' => 'btn-primary btn-sm add-content-button'], 'label' => 'Add', 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole()), 'icon' => 'fa fa-plus']); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $attr = ['class' => 'timepicker', 'data-show-meridian' => $options['showMeridian'] ? 'true' : 'false', 'data-default-time' => $options['defaultTime'], 'data-show-seconds' => $options['showSeconds'], 'data-explicit-mode' => $options['explicitMode']]; if ($options['minuteStep']) { $attr['data-minute-step'] = $options['minuteStep']; } $builder->add('data_value', TextType::class, ['label' => isset($options['label']) ? $options['label'] : $fieldType->getName(), 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole()), 'required' => false, 'attr' => $attr]); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $builder->add('data_value', IconTextType::class, ['label' => null != $options['label'] ? $options['label'] : $fieldType->getName(), 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole()), 'icon' => $options['icon'], 'attr' => ['class' => 'ems_daterangepicker', 'data-display-option' => json_encode($fieldType->getDisplayOptions())]]); }
/** * * {@inheritdoc} * */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $builder->add('data_value', TextType::class, ['label' => isset($options['label']) ? $options['label'] : $fieldType->getName(), 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole()), 'attr' => ['class' => 'datepicker', 'data-date-format' => $fieldType->getDisplayOptions()['displayFormat'], 'data-today-highlight' => $fieldType->getDisplayOptions()['todayHighlight'], 'data-week-start' => $fieldType->getDisplayOptions()['weekStart'], 'data-days-of-week-highlighted' => $fieldType->getDisplayOptions()['daysOfWeekHighlighted'], 'data-days-of-week-disabled' => $fieldType->getDisplayOptions()['daysOfWeekDisabled'], 'data-multidate' => $fieldType->getDisplayOptions()['multidate'] ? "true" : "false"]]); }
/** * * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { /** @var FieldType $fieldType */ $fieldType = $builder->getOptions()['metadata']; $builder->add('text_value', TextareaSymfonyType::class, ['attr' => ['class' => 'ckeditor_ems', 'data-height' => $options['height']], 'label' => $options['label'], 'required' => false, 'disabled' => !$this->authorizationChecker->isGranted($fieldType->getMinimumRole())]); }