function webform_test_options_webform_options_alter in Webform 8.5
Same name and namespace in other branches
- 6.x tests/modules/webform_test_options/webform_test_options.module \webform_test_options_webform_options_alter()
Implements hook_webform_options_alter().
File
- tests/
modules/ webform_test_options/ webform_test_options.module, line 22 - Support module for webform that provides form alter hook for wizard cause tests.
Code
function webform_test_options_webform_options_alter(array &$options, array &$element, $id) {
if ($id === 'custom') {
$options = [
'one' => t('One'),
'two' => t('Two'),
'three' => t('Three'),
];
// Set the default value to one of the added options.
$element['#default_value'] = 'one';
}
}