diff options
Diffstat (limited to 'modules/field/field.module')
-rw-r--r-- | modules/field/field.module | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/field/field.module b/modules/field/field.module index 4d031e935..a4e9e4d12 100644 --- a/modules/field/field.module +++ b/modules/field/field.module @@ -131,6 +131,11 @@ define('FIELD_QUERY_COMPLETE', 'FIELD_QUERY_COMPLETE'); class FieldException extends Exception {} /** + * Exception class thrown by hook_field_update_forbid(). + */ +class FieldUpdateForbiddenException extends FieldException {} + +/** * Implement hook_flush_caches. */ function field_flush_caches() { @@ -611,6 +616,19 @@ function field_view_field($obj_type, $object, $field, $instance, $build_mode = ' } /** + * 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_has_data($field) { + $results = field_attach_query($field['id'], array(), 1); + return !empty($results); +} + +/** * Determine whether the user has access to a given field. * * @param $op |