public function getOptionsData(BuilderInterface $builder, Field $entity, $normalize = false) { $config = $entity->getOptions(); foreach ($builder->supportsOptions($entity) as $optionClass) { $option = $this->getCachedObject($optionClass); foreach ($option->getDefaults($entity) as $key => $value) { if (!isset($config[$key])) { $config[$key] = $value; } } } $entity->setOptions($config); if (!$normalize) { return $entity->getOptions(); } $options = []; foreach ($builder->supportsOptions($entity) as $optionClass) { $option = $this->getCachedObject($optionClass); $test = $option->normalize($entity, $options); if (is_array($test)) { $options = $test; } } return array_merge_recursive($options, ['label' => $entity->getLabel(), 'required' => $entity->isRequired(), 'attr' => ['help_text' => $entity->getHelp()]]); }
public function normalize(Field $entity, array $options) { $config = $entity->getOptions(); if ($config['disabled']) { $options['disabled'] = true; } return $options; }
public function normalize(Field $entity, array $options) { $config = $entity->getOptions(); if ($config['readonly']) { $options['attr']['readonly'] = true; } return $options; }
public function normalize(Field $entity, array $options) { $config = $entity->getOptions(); $options['trim'] = $config['trim']; return $options; }