You are here

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

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

Convert options to array that can serialized to Drupal's configuration management system.

Parameters

array $options: An associative array containing options value and text.

Return value

array An array contain option text and value.

3 calls to WebformOptionsHelper::encodeConfig()
EmailWebformHandler::submitConfigurationForm in src/Plugin/WebformHandler/EmailWebformHandler.php
Form submission handler.
WebformOptionsHelperTest::testEncodeConfig in tests/src/Unit/Utility/WebformOptionsHelperTest.php
Tests WebformOptionsHelper::encodeConfig().
webform_update_8042 in includes/webform.install.update.inc
Issue #2875371: Can't Add Email Handler w/Select "Send To".

File

src/Utility/WebformOptionsHelper.php, line 305

Class

WebformOptionsHelper
Helper class webform options based methods.

Namespace

Drupal\webform\Utility

Code

public static function encodeConfig(array $options) {
  $config = [];
  foreach ($options as $option_value => $option_text) {
    $config[] = [
      'value' => $option_value,
      'text' => $option_text,
    ];
  }
  return $config;
}