public function NameItem::isEmpty in Name Field 8
Determines whether the data structure is empty.
Return value
bool TRUE if the data structure is empty, FALSE otherwise.
Overrides Map::isEmpty
File
- src/
Plugin/ Field/ FieldType/ NameItem.php, line 130
Class
- NameItem
- Plugin implementation of the 'name' field type.
Namespace
Drupal\name\Plugin\Field\FieldTypeCode
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) {
// Title & generational have no meaning by themselves.
if ($name == 'title' || $name == 'generational') {
continue;
}
if (isset($value) && strlen($value) && !isset($this->properties[$name])) {
return FALSE;
}
}
}
return TRUE;
}