Resolve #3418165 "Support emptyoption for"
4 unresolved threads
Closes #3418165
Merge request reports
Activity
assigned to @geekygnr
added 1 commit
- 414f2dd1 - Correct php error causing variable access error.
24 24 /** 25 25 * {@inheritdoc} 26 26 */ 27 public function viewElements(FieldItemListInterface $items, $langcode) { 27 public function viewElements(FieldItemListInterface $items, $langcode): array { 28 * 29 * @var array 30 */ 31 private array $options; 29 32 30 33 /** 31 * {@inheritdoc} 34 * Get the column name of the field. 35 * 36 * @return string 37 * The column name. 32 38 */ 33 public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings) { 34 parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings); 35 $this->column = $field_definition->getFieldStorageDefinition()->getMainPropertyName(); 39 private function getColumn(): string { 51 51 $properties['link_type'] = DataDefinition::create('string') 52 52 ->setLabel(t('Link Type')) 53 53 ->addConstraint('Length', ['max' => 255]) 54 ->setRequired(TRUE); 54 ->setRequired(FALSE); If there would have been tests added, it would have shown that the form validation fails with "The value you selected is not a valid choice." and cannot be saved unless you select a value to this field.
Edited by Adam Nagy
Please register or sign in to reply