public static function WebformOptionsHelper::convertOptionsToString in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Utility/WebformOptionsHelper.php \Drupal\webform\Utility\WebformOptionsHelper::convertOptionsToString()
Convert options with TranslatableMarkup into strings.
Parameters
array $options: An associative array of options with TranslatableMarkup.
Return value
array An associative array of options of strings,
6 calls to WebformOptionsHelper::convertOptionsToString()
- WebformImageSelectImagesForm::getImages in modules/
webform_image_select/ src/ WebformImageSelectImagesForm.php - Get options.
- WebformOptions::preSave in src/
Entity/ WebformOptions.php - Acts on an entity before the presave hook is invoked.
- WebformOptionsCustomForm::getOptions in modules/
webform_options_custom/ src/ WebformOptionsCustomForm.php - Get options.
- WebformOptionsForm::getOptions in src/
WebformOptionsForm.php - Get options.
- WebformOptionsHelperTest::testConvertOptionsToString in tests/
src/ Unit/ Utility/ WebformOptionsHelperTest.php - Tests WebformOptionsHelper::convertOptionsToString().
File
- src/
Utility/ WebformOptionsHelper.php, line 186
Class
- WebformOptionsHelper
- Helper class webform options based methods.
Namespace
Drupal\webform\UtilityCode
public static function convertOptionsToString(array $options) {
$strings = [];
foreach ($options as $option_value => $option_text) {
if (is_array($option_text)) {
$strings[(string) $option_value] = self::convertOptionsToString($option_text);
}
else {
$strings[(string) $option_value] = (string) $option_text;
}
}
return $strings;
}