public static function WebformOptionsHelper::appendValueToText in Webform 8.5
Same name and namespace in other branches
- 6.x src/Utility/WebformOptionsHelper.php \Drupal\webform\Utility\WebformOptionsHelper::appendValueToText()
Append option value to option text.
Parameters
array $options: An associative array of options.
Return value
array An associative array of options.
3 calls to WebformOptionsHelper::appendValueToText()
- WebformAdminConfigElementsForm::buildForm in src/
Form/ AdminConfig/ WebformAdminConfigElementsForm.php - Form constructor.
- WebformElementBase::form in src/
Plugin/ WebformElementBase.php - Gets the actual configuration webform array to be built.
- WebformManagedFileBase::form in src/
Plugin/ WebformElement/ WebformManagedFileBase.php - Gets the actual configuration webform array to be built.
File
- src/
Utility/ WebformOptionsHelper.php, line 29
Class
- WebformOptionsHelper
- Helper class webform options based methods.
Namespace
Drupal\webform\UtilityCode
public static function appendValueToText(array $options) {
foreach ($options as $option_value => $option_text) {
if (is_array($option_text)) {
$options[$option_value] = self::appendValueToText($option_text);
}
else {
$options[$option_value] = $option_text . ' (' . $option_value . ')';
}
}
return $options;
}