You are here

function share_everywhere_update_8005 in Share Everywhere 8

Same name and namespace in other branches
  1. 2.x share_everywhere.install \share_everywhere_update_8005()

Uodate include_css and include_js configs due to schema changes.

File

./share_everywhere.install, line 82
Install, update, and uninstall functions for the Share Everywhere module.

Code

function share_everywhere_update_8005() {
  $config = \Drupal::configFactory()
    ->getEditable('share_everywhere.settings');
  $configs_to_update = [
    'include_css',
    'include_js',
  ];
  foreach ($configs_to_update as $config_name) {
    $existing_value = $config
      ->get($config_name);
    if ($existing_value !== NULL) {
      if ($existing_value) {
        $config
          ->set($config_name, $config_name);
      }
      else {
        $config
          ->set($config_name, '0');
      }
    }
  }
  $config
    ->save();
}