You are here

public function ZoneItemList::applyDefaultValue in Address 8

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 FieldItemList::applyDefaultValue

File

src/Plugin/Field/FieldType/ZoneItemList.php, line 18

Class

ZoneItemList
Represents a list of zone item field values.

Namespace

Drupal\address\Plugin\Field\FieldType

Code

public function applyDefaultValue($notify = TRUE) {
  if ($default_value = $this
    ->getFieldDefinition()
    ->getDefaultValue($this
    ->getEntity())) {
    foreach ($default_value as $index => $value) {
      $default_value[$index] = unserialize($value);
    }
    $this
      ->setValue($default_value, $notify);
  }
  else {
    parent::applyDefaultValue($notify);
  }
  return $this;
}