Drupal 8  8.0.2
DataReferenceDefinition Class Reference
Inheritance diagram for DataReferenceDefinition:

Public Member Functions

 getTargetDefinition ()
 
 setTargetDefinition (DataDefinitionInterface $definition)
 
- Public Member Functions inherited from DataDefinition
 __construct (array $values=array())
 
 getDataType ()
 
 setDataType ($type)
 
 getLabel ()
 
 setLabel ($label)
 
 getDescription ()
 
 setDescription ($description)
 
 isList ()
 
 isReadOnly ()
 
 setReadOnly ($read_only)
 
 isComputed ()
 
 setComputed ($computed)
 
 isRequired ()
 
 setRequired ($required)
 
 getClass ()
 
 setClass ($class)
 
 getSettings ()
 
 setSettings (array $settings)
 
 getSetting ($setting_name)
 
 setSetting ($setting_name, $value)
 
 getConstraints ()
 
 getConstraint ($constraint_name)
 
 setConstraints (array $constraints)
 
 addConstraint ($constraint_name, $options=NULL)
 
 offsetExists ($offset)
 
offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 toArray ()
 

Static Public Member Functions

static create ($target_data_type)
 
static createFromDataType ($data_type)
 
- Static Public Member Functions inherited from DataDefinition
static create ($type)
 
static createFromDataType ($type)
 

Protected Attributes

 $targetDefinition
 
- Protected Attributes inherited from DataDefinition
 $definition = array()
 

Detailed Description

A typed data definition class for defining references.

Note that this definition class assumes that the data type for referencing a certain target type is named "{TARGET_TYPE}_reference".

See Also

Member Function Documentation

static create (   $target_data_type)
static

Creates a new data reference definition.

Parameters
string$target_data_typeThe data type of the referenced data.
Returns
static

References Drupal\typedDataManager().

Referenced by LanguageItem\propertyDefinitions(), EntityReferenceItem\propertyDefinitions(), TypedDataDefinitionTest\testDataReferences(), and EntityTypedDataDefinitionTest\testEntityReferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static createFromDataType (   $data_type)
static

{Creates a new data definition object.This method is typically used by ::createDataDefinition() to build a definition object for an arbitrary data type. When the definition class is known, it is recommended to directly use the static create() method on that class instead; e.g.:

Parameters
string$data_typeThe data type, for which a data definition should be created.
Returns
static
Exceptions
\InvalidArgumentExceptionIf an unsupported data type gets passed to the class; e.g., 'string' to a definition class handling 'entity:* data types.
}

Implements DataDefinitionInterface.

getTargetDefinition ( )

{Gets the data definition of the referenced data.

Returns
The data definition of the referenced data.
}

Implements DataReferenceDefinitionInterface.

setTargetDefinition ( DataDefinitionInterface  $definition)

Sets the definition of the referenced data.

Parameters
\Drupal\Core\TypedData\DataDefinitionInterface$definitionThe target definition to set.
Returns
$this

The documentation for this class was generated from the following file: