You are here

function webform_update_8098 in Webform 6.x

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

Issue #2933705: Element Range.

File

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

Code

function webform_update_8098() {
  $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, '#range__output') !== FALSE) {

      // Convert properties.
      $elements = str_replace([
        '#range__output_prefix',
        '#range__output_suffix',
        '#range__output',
      ], [
        '#output__field_prefix',
        '#output__field_suffix',
        '#output',
      ], $elements);

      // Convert '#output': true to '#output': right.
      $elements = str_replace("'#output': true", "'#output': right", $elements);
      $webform_config
        ->set('elements', $elements);
      $webform_config
        ->save(TRUE);
    }
  }
}