You are here

function webform_update_8004 in Webform 6.x

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

Issue #2836948: Problem with autocomplete field. Change '#autocomplete_options' to '#autocomplete_items'.

File

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

Code

function webform_update_8004() {
  $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, '#autocomplete_options') !== FALSE) {
      $elements = str_replace('#autocomplete_options', '#autocomplete_items', $elements);
      $webform_config
        ->set('elements', $elements);
      $webform_config
        ->save(TRUE);
    }
  }
}