function MapItem::setValue
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php \Drupal\Core\Field\Plugin\Field\FieldType\MapItem::setValue()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php \Drupal\Core\Field\Plugin\Field\FieldType\MapItem::setValue()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/MapItem.php \Drupal\Core\Field\Plugin\Field\FieldType\MapItem::setValue()
Overrides FieldItemBase::setValue
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ MapItem.php, line 56
Class
- MapItem
- Defines the 'map' entity field type.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function setValue($values, $notify = TRUE) {
$this->values = [];
if (!isset($values)) {
return;
}
if (!is_array($values)) {
if ($values instanceof MapItem) {
$values = $values->getValue();
}
else {
$values = unserialize($values, [
'allowed_classes' => FALSE,
]);
}
}
$this->values = $values;
// Notify the parent of any changes.
if ($notify && isset($this->parent)) {
$this->parent
->onChange($this->name);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.