You are here

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

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

Strip tags from options.

Parameters

array $options: An associative array of options.

Return value

array Options with HTML tags removed

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

File

src/Utility/WebformOptionsHelper.php, line 208

Class

WebformOptionsHelper
Helper class webform options based methods.

Namespace

Drupal\webform\Utility

Code

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