DataReferenceDefinition::create

public static DataReferenceDefinition::create($target_data_type)

Creates a new data reference definition.

Parameters

string $target_data_type: The data type of the referenced data.

Return value

static

Overrides DataDefinition::create

File

core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php, line 28

Class

DataReferenceDefinition
A typed data definition class for defining references.

Namespace

Drupal\Core\TypedData

Code

public static function create($target_data_type) {
  // This assumes implementations use a "TYPE_reference" naming pattern.
  $definition = parent::create($target_data_type . '_reference');
  return $definition->setTargetDefinition(\Drupal::typedDataManager()->createDataDefinition($target_data_type));
}
doc_Drupal
2016-10-29 09:00:16
Comments
Leave a Comment

Please login to continue.