You are here

function webform_update_8048 in Webform 6.x

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

Issue #2879421: Cleanup webform.settings.

1 call to webform_update_8048()
webform_update_8073 in includes/webform.install.update.inc
Issue #2905955: Update hook webform_update_8048 is broken.

File

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

Code

function webform_update_8048() {
  _webform_update_admin_settings();
  $config = \Drupal::configFactory()
    ->getEditable('webform.settings');

  // Change webform.settings.purge_settings to webform.settings.purge.
  if ($config
    ->get('purge_settings')) {
    $config
      ->set('purge', $config
      ->get('purge_settings'));
    $config
      ->clear('purge_settings');
  }

  // Change webform.config.elements to webform.settings.element.
  if ($config
    ->get('elements')) {
    $config
      ->set('element', $config
      ->get('elements'));
    $config
      ->clear('elements');
  }

  // Change webform.settings.element.exclude_types to
  // webform.settings.element.exclude_elements.
  if (($element = $config
    ->get('element')) && isset($element['excluded_types'])) {
    $element['excluded_elements'] = $element['excluded_types'];
    unset($element['excluded_types']);
    $config
      ->set('element', $element);
  }
  $config
    ->save();
}