public function testToFormFieldOptions() { $node = new FieldNodeDefinition(self::TEST_NAME, $this->testDefinition); $result = $node->toFormFieldOptions(); $this->assertArrayHasKey('target_field', $result); $this->assertEquals($node, $result['target_field']); $this->assertArrayNotHasKey('some_opt', $result); $options = ['label' => 'someLabel', 'required' => true, 'block' => 'some_block', 'subblock' => 'some_subblock']; $node->setOptions($options); $result = $node->toFormFieldOptions(); foreach ($options as $optionName => $value) { $this->assertArrayHasKey($optionName, $result); $this->assertEquals($value, $result[$optionName]); } }
protected function addFieldToForm(FormBuilderInterface $form, FieldNodeDefinition $fieldDefinition) { if ($fieldDefinition->getAclResource() && !$this->checkIsGranted($fieldDefinition->getAclResource())) { // field is not allowed to be shown, do nothing return; } $name = str_replace(ConfigManager::SECTION_MODEL_SEPARATOR, ConfigManager::SECTION_VIEW_SEPARATOR, $fieldDefinition->getName()); $form->add($name, 'oro_config_form_field_type', $fieldDefinition->toFormFieldOptions()); }