diff options
Diffstat (limited to 'modules/field/field.attach.inc')
-rw-r--r-- | modules/field/field.attach.inc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/field/field.attach.inc b/modules/field/field.attach.inc index 5f2229376..7571ee4fc 100644 --- a/modules/field/field.attach.inc +++ b/modules/field/field.attach.inc @@ -153,7 +153,7 @@ define('FIELD_STORAGE_INSERT', 'insert'); * An associative array of additional options, with the following keys: * - 'field_name': The name of the field whose operation should be * invoked. By default, the operation is invoked on all the fields - * in the object's bundle. NOTE: This option is not compatible with + * in the object's bundle. NOTE: This option is not compatible with * the 'deleted' option; the 'field_id' option should be used * instead. * - 'field_id': The id of the field whose operation should be @@ -1012,6 +1012,19 @@ function field_attach_query_revisions($field_id, $conditions, $count, &$cursor = } /** + * Determine whether a field has any data. + * + * @param $field + * A field structure. + * @return + * TRUE if the field has data for any object; FALSE otherwise. + */ +function field_attach_field_has_data($field) { + $results = field_attach_query($field['id'], array(), 1); + return !empty($results); +} + +/** * Generate and return a structured content array tree suitable for * drupal_render() for all of the fields on an object. The format of * each field's rendered content depends on the display formatter and |