_options_values_in_use($entity_type, $field_name, $values)
Checks if a list of values are being used in actual field values.
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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!options!options.module/function/_options_values_in_use/8.1.x