You are here

function diff_update_8006 in Diff 8

Update settings, set the new keys of layout plugins.

File

./diff.install, line 115
Installation hooks for diff module.

Code

function diff_update_8006() {
  $config = \Drupal::configFactory()
    ->getEditable('diff.settings');
  $layout_manager = \Drupal::service('plugin.manager.diff.layout');
  $layout_manager
    ->clearCachedDefinitions();
  $plugins = $layout_manager
    ->getDefinitions();
  $config
    ->clear('general_settings.layout_plugins');
  foreach ($plugins as $key => $value) {
    $plugin_options[$key] = $value['label'];
    $config
      ->set('general_settings.layout_plugins.' . $key . '.enabled', TRUE);
  }
  $config
    ->save();
}