function OptionsHooks::hasValuesInUse
Checks if a list of values is being used in actual field values.
Parameters
string $entity_type_id: The entity type ID.
string $field_name: The field name.
array $values: The values to check.
1 call to OptionsHooks::hasValuesInUse()
- OptionsHooks::fieldStorageConfigUpdateForbid in core/
modules/ options/ src/ Hook/ OptionsHooks.php - Implements hook_field_storage_config_update_forbid().
File
-
core/
modules/ options/ src/ Hook/ OptionsHooks.php, line 81
Class
- OptionsHooks
- Hook implementations for options.
Namespace
Drupal\options\HookCode
protected function hasValuesInUse(string $entity_type_id, string $field_name, array $values) : bool {
if ($values) {
$result = \Drupal::entityQuery($entity_type_id)->accessCheck(FALSE)
->condition($field_name . '.value', $values, 'IN')
->count()
->range(0, 1)
->execute();
if ($result) {
return TRUE;
}
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.