You are here

public static function Dropdown::propertyDefinitions in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  2. 8 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  3. 8.2 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  4. 8.3 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  5. 8.4 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  6. 8.5 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  7. 8.6 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  8. 8.7 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  9. 8.8 modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  10. 10.3.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  11. 10.0.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()
  12. 10.2.x modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php \Drupal\dropdown\Plugin\Field\FieldType\Dropdown::propertyDefinitions()

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides FieldItemInterface::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php, line 36

Class

Dropdown
Plugin implementation of the 'dropdown' field type.

Namespace

Drupal\dropdown\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['value'] = DataDefinition::create('string')
    ->setLabel(t('Text value'))
    ->addConstraint('Length', [
    'max' => 255,
  ])
    ->setRequired(TRUE);
  return $properties;
}