| Versions | |
|---|---|
| 7 | field_has_data($field) |
Determine whether a field has any data.
$field A field structure.
TRUE if the field has data for any entity; FALSE otherwise.
drupal/
<?php
function field_has_data($field) {
$query = new EntityFieldQuery();
return (bool) $query
->fieldCondition($field)
->range(0, 1)
->count()
->execute();
}
?>