You are here

function webform_update_8093 in Webform 6.x

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

Issue #2924551: Move the WebformComposite element to WebformCustomComposite.

File

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

Code

function webform_update_8093() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform.') as $config_name) {
    $config = $config_factory
      ->getEditable($config_name);
    $elements = $config
      ->get('elements');
    if (strpos($elements, "'#type': webform_composite") !== FALSE) {
      $elements = str_replace("'#type': webform_composite", "'#type': webform_custom_composite", $elements);
      $config
        ->set('elements', $elements);
      $config
        ->save(TRUE);
    }
  }
}