You are here

views_merge_rows.install in Views Merge Rows 8

Same filename and directory in other branches
  1. 8.2 views_merge_rows.install

Module install file.

File

views_merge_rows.install
View source
<?php

/**
 * @file
 * Module install file.
 */

/**
 * Implements hook_install().
 */
function views_merge_rows_install() {
  $config = \Drupal::service('config.factory')
    ->getEditable('views.settings');
  $display_extenders = $config
    ->get('display_extenders') ?: [];
  $display_extenders[] = 'views_merge_rows';
  $config
    ->set('display_extenders', $display_extenders);
  $config
    ->save();
}

/**
 * Implements hook_uninstall().
 */
function views_merge_rows_uninstall() {
  $config = \Drupal::service('config.factory')
    ->getEditable('views.settings');
  $display_extenders = $config
    ->get('display_extenders') ?: [];
  $key = array_search('views_merge_rows', $display_extenders);
  if ($key !== FALSE) {
    unset($display_extenders[$key]);
    $config
      ->set('display_extenders', $display_extenders);
    $config
      ->save();
  }
}

Functions