You are here

public static function MinisiteItem::propertyDefinitions in Mini site 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 FileItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/MinisiteItem.php, line 99

Class

MinisiteItem
Plugin implementation of the Minisite field type.

Namespace

Drupal\minisite\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);

  // Remove properties set by the parent class.
  unset($properties['display']);
  $properties['asset_path'] = DataDefinition::create('string')
    ->setLabel(t('Minisite asset path'));
  $properties['options'] = MapDataDefinition::create()
    ->setLabel(t('Options'));
  $properties['alias_status'] = DataDefinition::create('boolean')
    ->setLabel(t('Minisite URL alias status'));
  return $properties;
}