You are here

protected function WebformTranslationConfigManager::alterConfigFieldForm in Webform 6.x

Alter the webform field configuration form.

Parameters

string $config_name: The webform field configuration name.

array $config_element: The webform field configuration element.

1 call to WebformTranslationConfigManager::alterConfigFieldForm()
WebformTranslationConfigManager::alterForm in src/WebformTranslationConfigManager.php
Alter config translation form.

File

src/WebformTranslationConfigManager.php, line 165

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function alterConfigFieldForm($config_name, array &$config_element) {
  if (!isset($config_element['default_value'])) {
    return;
  }
  if (!preg_match('/^field\\.field\\.([_a-z0-9]+)\\.([_a-z0-9]+)\\.([_a-z0-9]+)$/', $config_name, $match)) {
    return;
  }
  $field = FieldConfig::loadByName($match[1], $match[2], $match[3]);
  if (!$field
    ->getType() === 'webform') {
    return;
  }
  foreach (Element::children($config_element['default_value']) as $key) {
    if (isset($config_element['default_value'][$key]['default_data'])) {
      $this
        ->alterTextareaElement($config_element['default_value'][$key]['default_data']);
    }
  }
}