You are here

function options_test_allowed_values_callback in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/options/tests/options_test/options_test.module \options_test_allowed_values_callback()

Implements callback_allowed_values_function().

See also

options_allowed_values()

2 string references to 'options_test_allowed_values_callback'
OptionsWidgetsTest::testSelectListMultiple in core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
Tests the 'options_select' widget (multiple select).
OptionsWidgetsTest::testSelectListSingle in core/modules/options/tests/src/Functional/OptionsWidgetsTest.php
Tests the 'options_select' widget (single select).

File

core/modules/options/tests/options_test/options_test.module, line 16
Helper module for the List module tests.

Code

function options_test_allowed_values_callback(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL) {
  $values = [
    'Group 1' => [
      0 => 'Zero',
    ],
    1 => 'One',
    'Group 2' => [
      2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',
    ],
    'More <script>dangerous</script> markup' => [
      3 => 'Three',
    ],
  ];
  return $values;
}