function OptionsAllowedValues::simpleValues

Implements callback_allowed_values_function().

See also

options_allowed_values()

File

core/modules/options/tests/options_test/src/OptionsAllowedValues.php, line 20

Class

OptionsAllowedValues
Provide allowed values callback.

Namespace

Drupal\options_test

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.