improvements-2.x-dev/modules/improvements_views/improvements_views.install

modules/improvements_views/improvements_views.install
<?php

/**
 * Implements hook_install().
 */
function improvements_views_install(): void {
  // Enable improvements_display_extender plugin.
  if (\Drupal::service('module_handler')->moduleExists('views')) {
    $config = \Drupal::service('config.factory')->getEditable('views.settings');
    $display_extenders = $config->get('display_extenders') ?: [];
    $display_extenders[] = 'improvements_display_extender';
    $config->set('display_extenders', $display_extenders);
    $config->save();
  }
}

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

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc