You are here

function webform_update_8133 in Webform 6.x

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

Issue #2890861: Webform toggle element is not accessible.

File

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

Code

function webform_update_8133() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('webform.webform.') as $webform_config_name) {
    $webform_config = $config_factory
      ->getEditable($webform_config_name);
    $data = $webform_config
      ->getRawData();
    $yaml = Yaml::encode($data);
    if (strpos($yaml, 'webform_toggle')) {
      return;
    }
  }
  $admin_config = \Drupal::configFactory()
    ->getEditable('webform.settings');
  $settings = $admin_config
    ->getRawData();
  $settings['libraries']['excluded_libraries'][] = 'jquery.toggles';
  $admin_config
    ->setData($settings)
    ->save();
}