You are here

public function ZoneItem::setValue in Address 8

Overrides \Drupal\Core\TypedData\TypedData::setValue().

Parameters

array|null $values: An array of property values.

Overrides FieldItemBase::setValue

File

src/Plugin/Field/FieldType/ZoneItem.php, line 81

Class

ZoneItem
Plugin implementation of the 'zone' field type.

Namespace

Drupal\address\Plugin\Field\FieldType

Code

public function setValue($values, $notify = TRUE) {
  if (is_array($values)) {

    // The property definition causes the zone to be in 'value' key.
    $values = reset($values);
  }
  if (!$values instanceof Zone) {
    $values = NULL;
  }
  parent::setValue($values, $notify);
}