You are here

function _list_values_in_use in Drupal 7

Checks if a list of values are being used in actual field values.

2 calls to _list_values_in_use()
list_allowed_values_setting_validate in modules/field/modules/list/list.module
Element validate callback; check that the entered values are valid.
list_field_update_forbid in modules/field/modules/list/list.module
Implements hook_field_update_forbid().

File

modules/field/modules/list/list.module, line 371
Defines list field types that can be used with the Options module.

Code

function _list_values_in_use($field, $values) {
  if ($values) {
    $query = new EntityFieldQuery();
    $found = $query
      ->fieldCondition($field['field_name'], 'value', $values)
      ->range(0, 1)
      ->execute();
    return !empty($found);
  }
  return FALSE;
}