Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
Overrides Map::getPropertyDefinitions
public function getPropertyDefinitions() {
// Definitions vary by entity type, so key them by entity type.
$target_type = $this->definition['settings']['target_type'];
if (!isset(self::$propertyDefinitions[$target_type])) {
static::$propertyDefinitions[$target_type]['target_id'] = array(
// @todo: Lookup the entity type's ID data type and use it here.
'type' => 'integer',
'label' => t('Entity ID'),
'constraints' => array(
'Range' => array(
'min' => 0,
),
),
);
static::$propertyDefinitions[$target_type]['entity'] = array(
'type' => 'entity',
'constraints' => array(
'EntityType' => $target_type,
),
'label' => t('Entity'),
'description' => t('The referenced entity'),
// The entity object is computed out of the entity ID.
'computed' => TRUE,
'read-only' => FALSE,
'settings' => array(
'id source' => 'target_id',
),
);
}
return static::$propertyDefinitions[$target_type];
}