Interface for entity field items, which are complex data objects containing the values.
When implementing this interface which extends Traversable, make sure to list IteratorAggregate or Iterator before this interface in the implements clause.
Expanded class hierarchy of FieldItemInterface
All classes that implement FieldItemInterface
\Drupal\Core\Entity\Field\FieldInterface
\Drupal\Core\Entity\Field\FieldItemBase
interface FieldItemInterface extends ComplexDataInterface, ContextAwareInterface, TypedDataInterface {
/**
* Magic getter: Get the property value.
*
* @param $property_name
* The name of the property to get; e.g., 'title' or 'name'.
*
* @throws \InvalidArgumentException
* If a not existing property is accessed.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The property object.
*/
public function __get($property_name);
/**
* Magic setter: Set the property value.
*
* @param $property_name
* The name of the property to set; e.g., 'title' or 'name'.
* @param $value
* The value to set, or NULL to unset the property. Optionally, a typed
* data object implementing Drupal\Core\TypedData\TypedDataInterface may be
* passed instead of a plain value.
*
* @throws \InvalidArgumentException
* If a not existing property is set.
*/
public function __set($property_name, $value);
/**
* Magic method for isset().
*
* @param $property_name
* The name of the property to get; e.g., 'title' or 'name'.
*
* @return boolean
* Returns TRUE if the property exists and is set, FALSE otherwise.
*/
public function __isset($property_name);
/**
* Magic method for unset().
*
* @param $property_name
* The name of the property to get; e.g., 'title' or 'name'.
*/
public function __unset($property_name);
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ComplexDataInterface:: |
public | function | Gets a property object. | 5 |
ComplexDataInterface:: |
public | function | Gets an array of property objects. | 5 |
ComplexDataInterface:: |
public | function | Gets the definition of a contained property. | 5 |
ComplexDataInterface:: |
public | function | Gets an array property definitions of contained properties. | 12 |
ComplexDataInterface:: |
public | function | Gets an array of property values. | 5 |
ComplexDataInterface:: |
public | function | Determines whether the data structure is empty. | 5 |
ComplexDataInterface:: |
public | function | Sets a property value. | 5 |
ComplexDataInterface:: |
public | function | Sets multiple property values. | 5 |
ContextAwareInterface:: |
public | function | Returns the name of a property or item. | 6 |
ContextAwareInterface:: |
public | function | Returns the parent data structure; i.e. either complex data or a list. | 6 |
ContextAwareInterface:: |
public | function | Sets the name of a property or item. | 6 |
ContextAwareInterface:: |
public | function | Sets the parent of a property or item. | 6 |
FieldItemInterface:: |
public | function | Magic getter: Get the property value. | 1 |
FieldItemInterface:: |
public | function | Magic method for isset(). | 1 |
FieldItemInterface:: |
public | function | Magic setter: Set the property value. | 1 |
FieldItemInterface:: |
public | function | Magic method for unset(). | 1 |
TypedDataInterface:: |
public | function | Gets the data definition. | 1 |
TypedDataInterface:: |
public | function | Returns a string representation of the data. | 1 |
TypedDataInterface:: |
public | function | Gets the data type. | 1 |
TypedDataInterface:: |
public | function | Gets the data value. | 1 |
TypedDataInterface:: |
public | function | Sets the data value. | 1 |
TypedDataInterface:: |
public | function | Validates the currently set data value. | 13 |