You are here

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

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

Convert config from Drupal's configuration management system to options array.

Parameters

array $config: An array contain option text and value.

Return value

array An associative array containing options value and text.

3 calls to WebformOptionsHelper::decodeConfig()
EmailWebformHandler::buildElement in src/Plugin/WebformHandler/EmailWebformHandler.php
Build A select other element for email address and names.
EmailWebformHandler::getMessageEmails in src/Plugin/WebformHandler/EmailWebformHandler.php
Get message to, cc, bcc, and from email addresses.
WebformOptionsHelperTest::testDecodeConfig in tests/src/Unit/Utility/WebformOptionsHelperTest.php
Tests WebformOptionsHelper::decodeConfig().

File

src/Utility/WebformOptionsHelper.php, line 325

Class

WebformOptionsHelper
Helper class webform options based methods.

Namespace

Drupal\webform\Utility

Code

public static function decodeConfig(array $config) {
  $options = [];
  foreach ($config as $option) {
    $options[$option['value']] = $option['text'];
  }
  return $options;
}