function StringItemBase::isEmpty

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase::isEmpty()
  2. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase::isEmpty()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase::isEmpty()

Overrides Map::isEmpty

1 call to StringItemBase::isEmpty()
UriItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
Determines whether the data structure is empty.
3 methods override StringItemBase::isEmpty()
PasswordItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php
Determines whether the data structure is empty.
UriItem::isEmpty in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
Determines whether the data structure is empty.
UserNameItem::isEmpty in core/modules/user/src/UserNameItem.php
Determines whether the data structure is empty.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php, line 39

Class

StringItemBase
Base class for string field types.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public function isEmpty() {
    $value = $this->get('value')
        ->getValue();
    return $value === NULL || $value === '';
}

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