interface FieldItemInterface

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.

Hierarchy

Expanded class hierarchy of FieldItemInterface

All classes that implement FieldItemInterface

See also

\Drupal\Core\Entity\Field\FieldInterface

\Drupal\Core\Entity\Field\FieldItemBase

3 files declare their use of FieldItemInterface
EntityFieldTest.php in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
Definition of Drupal\Core\Entity\Tests\EntityFieldTest.
JsonldFieldItemNormalizer.php in drupal/core/modules/jsonld/lib/Drupal/jsonld/JsonldFieldItemNormalizer.php
Definition of Drupal\jsonld\JsonldFieldItemNormalizer.
TaxonomyTermReferenceItemTest.php in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php
Contains \Drupal\taxonomy\Tests\TaxonomyTermReferenceItemTest.

File

drupal/core/lib/Drupal/Core/Entity/Field/FieldItemInterface.php, line 24
Definition of Drupal\Core\Entity\Field\FieldItemInterface.

Namespace

Drupal\Core\Entity\Field
View source
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);

}

Members

Namesort descending Modifiers Type Description Overrides
ComplexDataInterface::get public function Gets a property object. 5
ComplexDataInterface::getProperties public function Gets an array of property objects. 5
ComplexDataInterface::getPropertyDefinition public function Gets the definition of a contained property. 5
ComplexDataInterface::getPropertyDefinitions public function Gets an array property definitions of contained properties. 12
ComplexDataInterface::getPropertyValues public function Gets an array of property values. 5
ComplexDataInterface::isEmpty public function Determines whether the data structure is empty. 5
ComplexDataInterface::set public function Sets a property value. 5
ComplexDataInterface::setPropertyValues public function Sets multiple property values. 5
ContextAwareInterface::getName public function Returns the name of a property or item. 6
ContextAwareInterface::getParent public function Returns the parent data structure; i.e. either complex data or a list. 6
ContextAwareInterface::setName public function Sets the name of a property or item. 6
ContextAwareInterface::setParent public function Sets the parent of a property or item. 6
FieldItemInterface::__get public function Magic getter: Get the property value. 1
FieldItemInterface::__isset public function Magic method for isset(). 1
FieldItemInterface::__set public function Magic setter: Set the property value. 1
FieldItemInterface::__unset public function Magic method for unset(). 1
TypedDataInterface::getDefinition public function Gets the data definition. 1
TypedDataInterface::getString public function Returns a string representation of the data. 1
TypedDataInterface::getType public function Gets the data type. 1
TypedDataInterface::getValue public function Gets the data value. 1
TypedDataInterface::setValue public function Sets the data value. 1
TypedDataInterface::validate public function Validates the currently set data value. 13