You are here

function webform_update_8014 in Webform 6.x

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

Issue #2848042: Rework #type shorthand prefix handling.

File

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

Code

function webform_update_8014() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform.') as $webform_config_name) {
    $webform_config = $config_factory
      ->getEditable($webform_config_name);

    // Get data, get elements, and update elements #type.
    $data = $webform_config
      ->getRawData();
    $elements = Yaml::decode($data['elements']);

    // Make sure $elements has been decoded into an array.
    if (is_array($elements)) {
      _webform_update_8014($elements);

      // Set elements, set data, and save data.
      $data['elements'] = Yaml::encode($elements);
      $webform_config
        ->setData($data);
      $webform_config
        ->save();
    }
  }
}