_options_values_in_use($entity_type, $field_name, $values)
Checks if a list of values are being used in actual field values.
File
- core/modules/options/options.module, line 123
- Defines selection, check box and radio button widgets for text and numeric fields.
Code
function _options_values_in_use($entity_type, $field_name, $values) { if ($values) { $factory = \Drupal::service('entity.query'); $result = $factory->get($entity_type) ->condition($field_name . '.value', $values, 'IN') ->count() ->accessCheck(FALSE) ->range(0, 1) ->execute(); if ($result) { return TRUE; } } return FALSE; }
Please login to continue.