| 7 field.module | field_has_data($field) |
| 8 field.module | field_has_data($field) |
Determine whether a field has any data.
Parameters
$field: A field structure.
Return value
TRUE if the field has data for any entity; FALSE otherwise.
Related topics
3 calls to field_has_data()
File
- modules/
field/ field.module, line 969 - Attach custom data fields to Drupal entities.
Code
function field_has_data($field) {
$query = new EntityFieldQuery();
return (bool) $query
->fieldCondition($field)
->range(0, 1)
->count()
->execute();
}
Login or register to post comments