You are here

function webform_update_8209 in Webform 6.x

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

Issue #3174132: Add (admin) notes to handlers.

1 call to webform_update_8209()
webform_update_8620 in includes/webform.install.update.inc
Issue #3174132: Add (admin) notes to handlers.

File

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

Code

function webform_update_8209() {
  $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();
    $save = FALSE;
    foreach ($data['handlers'] as &$handler) {
      if (!isset($handler['notes'])) {
        WebformArrayHelper::insertAfter($handler, 'label', 'notes', '');
        $save = TRUE;
      }
    }
    if ($save) {
      $webform_config
        ->setData($data);
      $webform_config
        ->save();
    }
  }
}