function options_test_options_list_alter
Same name and namespace in other branches
- 10 core/modules/options/tests/options_test/options_test.module \options_test_options_list_alter()
Implements hook_options_list_alter().
File
-
core/
modules/ options/ tests/ options_test/ options_test.module, line 71
Code
function options_test_options_list_alter(array &$options, array $context) {
if ($context['fieldDefinition']->getName() === 'card_4' && $context['widget']->getPluginId() === 'options_select') {
// Rename _none option.
$options['_none'] = '- Select something -';
}
if ($context['fieldDefinition']->getName() === 'card_4' && $context['entity']->bundle() === 'entity_test') {
// Remove 0 option.
unset($options[0]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.