本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::getOptions方法的具体用法?PHP FormBuilderInterface::getOptions怎么用?PHP FormBuilderInterface::getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::getOptions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
*
* {@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);
}
}
}
示例2: buildForm
/**
*
* {@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']);
}
示例3: buildForm
/**
*
* {@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']]);
}
示例4: buildForm
/**
* {@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())]);
}
示例5: buildForm
/**
*
* {@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())]);
}
示例6: buildForm
/**
*
* {@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']);
}
示例7: buildForm
/**
*
* {@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]);
}
示例8: buildForm
/**
*
* {@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())]]);
}
示例9: buildForm
/**
*
* {@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"]]);
}
示例10: buildForm
/**
*
* @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())]);
}