function Map::isEmpty

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::isEmpty()
  2. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::isEmpty()
  3. 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php \Drupal\Core\TypedData\Plugin\DataType\Map::isEmpty()

Overrides ComplexDataInterface::isEmpty

17 methods override Map::isEmpty()
CommentItem::isEmpty in core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
Determines whether the data structure is empty.
DateTimeItem::isEmpty in core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
Determines whether the data structure is empty.
DummyAjaxItem::isEmpty in core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldType/DummyAjaxItem.php
Determines whether the data structure is empty.
EmailItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php
Determines whether the data structure is empty.
EntityReferenceItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Determines whether the data structure is empty.

... See full list

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php, line 187

Class

Map
The "map" data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function isEmpty() {
    foreach ($this->properties as $property) {
        $definition = $property->getDataDefinition();
        if (!$definition->isComputed() && $property->getValue() !== NULL) {
            return FALSE;
        }
    }
    if (isset($this->values)) {
        foreach ($this->values as $name => $value) {
            if (isset($value) && !isset($this->properties[$name])) {
                return FALSE;
            }
        }
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.