function ItemList::isEmpty
Determines whether the list contains any non-empty items.
Return value
bool TRUE if the list is empty, FALSE otherwise.
Overrides ListInterface::isEmpty
1 call to ItemList::isEmpty()
- EntityReferenceFieldItemList::referencedEntities in core/
lib/ Drupal/ Core/ Field/ EntityReferenceFieldItemList.php - Gets the entities referenced by this field, preserving field item deltas.
File
-
core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ ItemList.php, line 250
Class
- ItemList
- A generic list class.
Namespace
Drupal\Core\TypedData\Plugin\DataTypeCode
public function isEmpty() {
foreach ($this->list as $item) {
if ($item instanceof ComplexDataInterface || $item instanceof ListInterface) {
if (!$item->isEmpty()) {
return FALSE;
}
}
elseif ($item->getValue() !== NULL) {
return FALSE;
}
}
return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.