You are here

function yamlform_update_8024 in YAML Form 8

Issue #2765831: Improve text field autocompletion support.

File

includes/yamlform.update.inc, line 623
YAML Form module update hooks.

Code

function yamlform_update_8024() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('yamlform.yamlform.') as $yamlform_config_name) {
    $yamlform_config = $config_factory
      ->getEditable($yamlform_config_name);
    $yaml = Yaml::encode($yamlform_config
      ->getRawData());
    if (strpos($yaml, "'#autocomplete'") !== FALSE) {
      $yaml = str_replace("'#autocomplete'", "'#autocomplete_options'", $yaml);
      $data = Yaml::decode($yaml);
      $yamlform_config
        ->setData($data)
        ->save();
    }
  }
}