You are here

public static function FieldItemList::processDefaultValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldItemList.php \Drupal\Core\Field\FieldItemList::processDefaultValue()

Processes the default value before being applied.

Defined or configured default values of a field might need some processing in order to be a valid runtime value for the field type; e.g., a date field could process the defined value of 'NOW' to a valid date.

Parameters

array $default_value: The unprocessed default value defined for the field, as a numerically indexed array of items, each item being an array of property/value pairs.

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity for which the default value is generated.

\Drupal\Core\Field\FieldDefinitionInterface $definition: The definition of the field.

Return value

array The return default value for the field.

Overrides FieldItemListInterface::processDefaultValue

3 calls to FieldItemList::processDefaultValue()
DateRangeFieldItemList::processDefaultValue in core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeFieldItemList.php
Processes the default value before being applied.
DateTimeFieldItemList::processDefaultValue in core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
Processes the default value before being applied.
EntityReferenceFieldItemList::processDefaultValue in core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
Processes the default value before being applied.
2 methods override FieldItemList::processDefaultValue()
DateTimeFieldItemList::processDefaultValue in core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
Processes the default value before being applied.
EntityReferenceFieldItemList::processDefaultValue in core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
Processes the default value before being applied.

File

core/lib/Drupal/Core/Field/FieldItemList.php, line 331

Class

FieldItemList
Represents an entity field; that is, a list of field item objects.

Namespace

Drupal\Core\Field

Code

public static function processDefaultValue($default_value, FieldableEntityInterface $entity, FieldDefinitionInterface $definition) {
  return $default_value;
}