You are here

public function EntityAdapter::applyDefaultValue in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::applyDefaultValue()
  2. 10 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php \Drupal\Core\Entity\Plugin\DataType\EntityAdapter::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 TypedData::applyDefaultValue

1 method overrides EntityAdapter::applyDefaultValue()
ConfigEntityAdapter::applyDefaultValue in core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php
Applies the default value.

File

core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php, line 152

Class

EntityAdapter
Defines the "entity" data type.

Namespace

Drupal\Core\Entity\Plugin\DataType

Code

public function applyDefaultValue($notify = TRUE) {

  // Apply the default value of all properties.
  foreach ($this
    ->getProperties() as $property) {
    $property
      ->applyDefaultValue(FALSE);
  }
  return $this;
}