/** * Prepares options of attribute need to add corresponding form type * * @param Attribute $attribute * @param array $attributeOptions * @param array $options * @return array * @throws InvalidConfigurationException */ protected function prepareAttributeOptions(Attribute $attribute, array $attributeOptions, array $options) { /** @var Workflow $workflow */ $workflow = $options['workflow']; // ensure has form_type if (empty($attributeOptions['form_type'])) { throw new InvalidConfigurationException(sprintf('Parameter "form_type" must be defined for attribute "%s" in workflow "%s".', $attribute->getName(), $workflow->getName())); } // updates form options if (!isset($attributeOptions['options'])) { $attributeOptions['options'] = array(); } // updates form options label if (!isset($attributeOptions['options']['label'])) { $attributeOptions['options']['label'] = isset($attributeOptions['label']) ? $attributeOptions['label'] : $attribute->getLabel(); } if ($options['disable_attribute_fields']) { $attributeOptions['options']['disabled'] = true; } return $attributeOptions; }