public function TaxonomyTermReferenceItem::getPropertyDefinitions

Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().

Overrides Map::getPropertyDefinitions

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php, line 30
Contains \Drupal\taxonomy\Type\TaxonomyTermReferenceItem.

Class

TaxonomyTermReferenceItem
Defines the 'taxonomy_term_reference' entity field item.

Namespace

Drupal\taxonomy\Type

Code

public function getPropertyDefinitions() {
  if (!isset(static::$propertyDefinitions)) {
    static::$propertyDefinitions['tid'] = array(
      'type' => 'integer',
      'label' => t('Referenced taxonomy term id.'),
    );
    static::$propertyDefinitions['entity'] = array(
      'type' => 'entity',
      'constraints' => array(
        'EntityType' => 'taxonomy_term',
      ),
      'label' => t('Term'),
      'description' => t('The referenced taxonomy term'),
      // The entity object is computed out of the tid.
      'computed' => TRUE,
      'read-only' => FALSE,
      'settings' => array(
        'id source' => 'tid',
      ),
    );
  }
  return static::$propertyDefinitions;
}