class MapFieldItemList
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Field/MapFieldItemList.php \Drupal\Core\Field\MapFieldItemList
- 10 core/lib/Drupal/Core/Field/MapFieldItemList.php \Drupal\Core\Field\MapFieldItemList
- 8.9.x core/lib/Drupal/Core/Field/MapFieldItemList.php \Drupal\Core\Field\MapFieldItemList
Defines an item list class for map fields.
Hierarchy
- class \Drupal\Core\TypedData\TypedData extends \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\Plugin\DataType\ItemList extends \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ListInterface implements \Drupal\Core\TypedData\TypedData
- class \Drupal\Core\Field\FieldItemList extends \Drupal\Core\Field\FieldItemListInterface implements \Drupal\Core\TypedData\Plugin\DataType\ItemList
- class \Drupal\Core\Field\MapFieldItemList implements \Drupal\Core\Field\FieldItemList
- class \Drupal\Core\Field\FieldItemList extends \Drupal\Core\Field\FieldItemListInterface implements \Drupal\Core\TypedData\Plugin\DataType\ItemList
- class \Drupal\Core\TypedData\Plugin\DataType\ItemList extends \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ListInterface implements \Drupal\Core\TypedData\TypedData
Expanded class hierarchy of MapFieldItemList
File
-
core/
lib/ Drupal/ Core/ Field/ MapFieldItemList.php, line 8
Namespace
Drupal\Core\FieldView source
class MapFieldItemList extends FieldItemList {
/**
* {@inheritdoc}
*/
public function equals(FieldItemListInterface $list_to_compare) {
$count1 = count($this);
$count2 = count($list_to_compare);
if ($count1 === 0 && $count2 === 0) {
// Both are empty we can safely assume that it did not change.
return TRUE;
}
if ($count1 !== $count2) {
// The number of items is different so they do not have the same values.
return FALSE;
}
// The map field type does not have any property defined (because they are
// dynamic), so the only way to evaluate the equality for it is to rely
// solely on its values.
$value1 = $this->getValue();
$value2 = $list_to_compare->getValue();
return $value1 == $value2;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.