You are here

public function TypedData::applyDefaultValue in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::applyDefaultValue()
  2. 9 core/lib/Drupal/Core/TypedData/TypedData.php \Drupal\Core\TypedData\TypedData::applyDefaultValue()

Applies the default value.

Parameters

bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.

Return value

$this Returns itself to allow for chaining.

Overrides TypedDataInterface::applyDefaultValue

2 methods override TypedData::applyDefaultValue()
FieldItemList::applyDefaultValue in core/lib/Drupal/Core/Field/FieldItemList.php
Applies the default value.
Map::applyDefaultValue in core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php
Applies the default value.

File

core/lib/Drupal/Core/TypedData/TypedData.php, line 138

Class

TypedData
The abstract base class for typed data.

Namespace

Drupal\Core\TypedData

Code

public function applyDefaultValue($notify = TRUE) {

  // Default to no default value.
  $this
    ->setValue(NULL, $notify);
  return $this;
}