function _list_values_in_use

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.