| 1 field.api.php | hook_field_is_empty($item, $field, $instance) |
Define what constitutes an empty item for a field type.
@since 1.33.0 Added parameter $instance.
Parameters
array $item: An item that may or may not be empty.
array $field: The field to which $item belongs.
array $instance: Field API instance definition.
Return value
bool: TRUE if $field's type considers $item not to contain any data; FALSE otherwise.
Related topics
File
- core/
modules/ field/ field.api.php, line 709 - Hooks provided by the Field module.
Code
function hook_field_is_empty($item, $field, $instance) {
if (empty($item['value']) && (string) $item['value'] !== '0') {
return TRUE;
}
return FALSE;
}