5 * Helper module for the List module tests.
8 use Drupal\Core\Entity\FieldableEntityInterface;
9 use Drupal\Core\Field\FieldStorageDefinitionInterface;
12 * Implements callback_allowed_values_function().
14 * @see options_allowed_values()
16 function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
23 2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
25 'More <script>dangerous</script> markup' => [
34 * Implements callback_allowed_values_function().
36 * @todo This function violates the recommendation in options_allowed_values()
37 * to return a list of all possible values in any context when $items is
38 * NULL. Since this is not yet used for testing Views integration, that is
39 * alright for now. Fix this in https://www.drupal.org/node/2012130.
41 * @see options_allowed_values()
43 function options_test_dynamic_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL, &$cacheable = NULL) {
54 // We need the values of the entity as keys.
55 return array_combine($values, $values);