You are here

function webform_update_8124 in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.install.update.inc \webform_update_8124()

Issue #2971207: Hidden Field updated values not being captured on Submit.

File

includes/webform.install.update.inc, line 2261
Archived Webform update hooks.

Code

function webform_update_8124() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform.') as $webform_config_name) {
    $webform_config = $config_factory
      ->getEditable($webform_config_name);
    $data = $webform_config
      ->getRawData();
    if (strpos($data['elements'], "'#type': hidden") !== FALSE) {
      $elements = Yaml::decode($data['elements']);
      _webform_update_8124($elements);
      $data['elements'] = Yaml::encode($elements);
      $webform_config
        ->setData($data);
      $webform_config
        ->save();
    }
  }
}