You are here

public static function WebformOptionsHelper::decodeOptions in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Utility/WebformOptionsHelper.php \Drupal\webform\Utility\WebformOptionsHelper::decodeOptions()

Decode HTML entities in options.

Issue #2826451: TermSelection returning HTML characters in select list.

Parameters

array $options: An associative array of options.

Return value

array An associative array of options with HTML entities decoded.

1 call to WebformOptionsHelper::decodeOptions()
WebformEntityTrait::setOptions in src/Element/WebformEntityTrait.php
Set referencable entities as options for an element.

File

src/Utility/WebformOptionsHelper.php, line 231

Class

WebformOptionsHelper
Helper class webform options based methods.

Namespace

Drupal\webform\Utility

Code

public static function decodeOptions(array $options) {
  foreach ($options as $option_value => $option_text) {
    if (is_array($option_text)) {
      $options[$option_value] = self::decodeOptions($option_text);
    }
    else {
      $options[$option_value] = Html::decodeEntities((string) $option_text);
    }
  }
  return $options;
}