You are here

function webform_update_8149 in Webform 6.x

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

Issue #3007247: Custom composite fields appear as block elements.

File

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

Code

function webform_update_8149() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform.') as $webform_config_name) {
    $webform_config = $config_factory
      ->getEditable($webform_config_name);
    $elements = $webform_config
      ->get('elements');
    if (strpos($elements, "'add_more'") !== FALSE) {
      $elements = str_replace("'#add_more'", "'#add_more_items'", $elements);
      $elements = str_replace("'#multiple__add_more'", "'#multiple__add_more_items'", $elements);
      $webform_config
        ->set('elements', $elements);
      $webform_config
        ->save(TRUE);
    }
  }
}