You are here

public function PasswordItem::isEmpty in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem::isEmpty()

Determines whether the data structure is empty.

Return value

bool TRUE if the data structure is empty, FALSE otherwise.

Overrides StringItemBase::isEmpty

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php, line 73

Class

PasswordItem
Defines the 'password' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public function isEmpty() {

  // We cannot use the parent implementation from StringItem as it does not
  // consider the additional 'existing' property that PasswordItem contains.
  $value = $this
    ->get('value')
    ->getValue();
  $existing = $this
    ->get('existing')
    ->getValue();
  return $value === NULL && $existing === NULL;
}