You are here

public static function WebformElementHelper::convertRenderMarkupToStrings in Webform 6.x

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

Convert all render(able) markup into strings.

This method is used to prevent objects from being serialized on form's that are using #ajax callbacks or rebuilds.

Parameters

array $elements: An associative array of elements.

12 calls to WebformElementHelper::convertRenderMarkupToStrings()
DebugWebformHandler::submitForm in src/Plugin/WebformHandler/DebugWebformHandler.php
Submit webform submission form.
EmailWebformHandler::buildConfigurationForm in src/Plugin/WebformHandler/EmailWebformHandler.php
Form constructor.
WebformElementHelperTest::testConvertRenderMarkupToStrings in tests/src/Unit/Utility/WebformElementHelperTest.php
Tests WebformElementHelper::convertRenderMarkupToStrings().
WebformElementPluginDefinitionsTest::getActualElementDefinitions in tests/src/Functional/Element/WebformElementPluginDefinitionsTest.php
Get actual element definitions.
WebformElementPluginPropertiesTest::getActualElementDefaultProperties in tests/src/Functional/Element/WebformElementPluginPropertiesTest.php
Get actual element default properties.

... See full list

File

src/Utility/WebformElementHelper.php, line 635

Class

WebformElementHelper
Helper class webform element methods.

Namespace

Drupal\webform\Utility

Code

public static function convertRenderMarkupToStrings(array &$elements) {
  foreach ($elements as $key => &$value) {
    if (is_array($value)) {
      self::convertRenderMarkupToStrings($value);
    }
    elseif ($value instanceof MarkupInterface) {
      $elements[$key] = (string) $value;
    }
  }
}