You are here

public static function MenuItemId::propertyDefinitions in Field Menu 8

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

src/Plugin/Field/FieldType/MenuItemId.php, line 67

Class

MenuItemId
Plugin implementation of the 'field_menu' field type.

Namespace

Drupal\field_menu\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['menu_title'] = DataDefinition::create('string')
    ->setLabel(t('Title'));
  $properties['menu_item_key'] = DataDefinition::create('string')
    ->setLabel('');
  $properties['include_root'] = DataDefinition::create('integer')
    ->setLabel(t('Include root'));
  $properties['max_depth'] = DataDefinition::create('integer')
    ->setLabel(t('Max depth'));
  return $properties;
}