field_has_data

Versions
7
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 object; FALSE otherwise.

Related topics

▾ 3 functions call field_has_data()

field_ui_field_edit_form in modules/field_ui/field_ui.admin.inc
Menu callback; presents the field instance edit page.
field_ui_field_settings_form in modules/field_ui/field_ui.admin.inc
Menu callback; presents the field settings edit page.
field_update_field in modules/field/field.crud.inc
Updates a field.

Code

modules/field/field.module, line 617

<?php
function field_has_data($field) {
  $results = field_attach_query($field['id'], array(), array('limit' => 1));
  return !empty($results);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.