public function FieldCollectionItem::isEmpty in Field collection 8
Same name and namespace in other branches
- 8.3 src/Entity/FieldCollectionItem.php \Drupal\field_collection\Entity\FieldCollectionItem::isEmpty()
Determine whether a field collection item entity is empty.
Checks individual collection-fields.
Return value
bool TRUE if the field collection item is empty.
Overrides FieldCollectionItemInterface::isEmpty
File
- src/
Entity/ FieldCollectionItem.php, line 328
Class
- FieldCollectionItem
- Defines the field collection item entity class.
Namespace
Drupal\field_collection\EntityCode
public function isEmpty() {
$is_empty = TRUE;
foreach ($this
->getIterator() as $field) {
// Only check configured fields, skip base fields like uuid.
if (!$field
->isEmpty() && 'Drupal\\field\\Entity\\FieldConfig' == get_class($field
->getFieldDefinition())) {
$is_empty = FALSE;
}
}
// TODO: Allow other modules a chance to alter the value before returning?
//drupal_alter('field_collection_is_empty', $is_empty, $this);
return $is_empty;
}