You are here

function diff_install in Diff 8

Same name and namespace in other branches
  1. 5.2 diff.install \diff_install()
  2. 5 diff.install \diff_install()
  3. 7.3 diff.install \diff_install()

Implements hook_install().

File

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

Code

function diff_install() {
  $visual_inline = \Drupal::service('plugin.manager.diff.layout')
    ->hasDefinition('visual_inline');

  // Enable Visual Inline layout if library found.
  if ($visual_inline) {
    $config = \Drupal::configFactory()
      ->getEditable('diff.settings');
    $settings_enabled = $config
      ->get('general_settings.layout_plugins.visual_inline.enabled');
    if (!$settings_enabled) {
      $config
        ->set('general_settings.layout_plugins.visual_inline.enabled', TRUE);
    }
    $config
      ->save();
  }
}