You are here

protected function Webform::initElementsTranslationsRecursive in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Entity/Webform.php \Drupal\webform\Entity\Webform::initElementsTranslationsRecursive()

Init elements translations before variants are applied.

This method applies translations to raw elements, while Webform::initElementsRecursive applies translations to elements before they are initialized.

Parameters

array $elements: The webform elements.

See also

\Drupal\webform\Entity\Webform::initElementsRecursive

1 call to Webform::initElementsTranslationsRecursive()
Webform::initElementsTranslation in src/Entity/Webform.php
Initialize elements translation.

File

src/Entity/Webform.php, line 1591

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

protected function initElementsTranslationsRecursive(array &$elements) {
  foreach ($elements as $key => &$element) {
    if (!WebformElementHelper::isElement($element, $key)) {
      continue;
    }
    if (isset($this->elementsTranslations[$key])) {
      WebformElementHelper::applyTranslation($element, $this->elementsTranslations[$key]);
    }
    $this
      ->initElementsTranslationsRecursive($element);
  }
}