FieldItemList::filterEmptyItems

public FieldItemList::filterEmptyItems()

Filters out empty field items and re-numbers the item deltas.

Return value

$this

Overrides FieldItemListInterface::filterEmptyItems

File

core/lib/Drupal/Core/Field/FieldItemList.php, line 90

Class

FieldItemList
Represents an entity field; that is, a list of field item objects.

Namespace

Drupal\Core\Field

Code

public function filterEmptyItems() {
  $this->filter(function($item) {
    return !$item->isEmpty();
  });
  return $this;
}
doc_Drupal
2016-10-29 09:11:54
Comments
Leave a Comment

Please login to continue.