function hook_field_collection_is_empty_alter in Field collection 7
Same name and namespace in other branches
- 8.3 field_collection.api.php \hook_field_collection_is_empty_alter()
- 8 field_collection.api.php \hook_field_collection_is_empty_alter()
Alter whether a field collection item is considered empty.
This hook allows modules to determine whether a field collection is empty before it is saved.
Parameters
bool $is_empty: Whether or not the field should be considered empty.
FieldCollectionItemEntity $item: The field collection we are currently operating on.
File
- ./
field_collection.api.php, line 24 - Contains API documentation and examples for the Field Collection.
Code
function hook_field_collection_is_empty_alter(&$is_empty, FieldCollectionItemEntity $item) {
if (isset($item->my_field) && empty($item->my_field)) {
$is_empty = TRUE;
}
}