You are here

function yamlform_update_8078 in YAML Form 8

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

File

./yamlform.install, line 261
Install, update and uninstall functions for the YAML Form module.

Code

function yamlform_update_8078() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('yamlform.yamlform.') as $yamlform_config_name) {
    $yamlform_config = $config_factory
      ->getEditable($yamlform_config_name);
    $elements = $yamlform_config
      ->get('elements');
    if (strpos($elements, '#autocomplete_options') !== FALSE) {
      $elements = str_replace('#autocomplete_options', '#autocomplete_items', $elements);
      $yamlform_config
        ->set('elements', $elements);
      $yamlform_config
        ->save(TRUE);
    }
  }
}