views_attach_library.install in Views Attach Library 8
Same filename and directory in other branches
Various install/uninstall hooks for the attach library views module.
File
views_attach_library.installView source
<?php
/**
* @file
* Various install/uninstall hooks for the attach library views module.
*/
/**
* Implements hook_install().
*/
function views_attach_library_install() {
// Enable library_in_views_display_extender plugin.
$config = \Drupal::service('config.factory')
->getEditable('views.settings');
$display_extenders = $config
->get('display_extenders') ?: [];
$display_extenders[] = 'library_in_views_display_extender';
$config
->set('display_extenders', $display_extenders);
$config
->save();
}
/**
* Implements hook_uninstall().
*/
function views_attach_library_uninstall() {
// Disable library_in_views_display_extender plugin.
$config = \Drupal::service('config.factory')
->getEditable('views.settings');
$display_extenders = $config
->get('display_extenders') ?: [];
$key = array_search('library_in_views_display_extender', $display_extenders);
if ($key !== FALSE) {
unset($display_extenders[$key]);
$config
->set('display_extenders', $display_extenders);
$config
->save();
}
}
Functions
Name | Description |
---|---|
views_attach_library_install | Implements hook_install(). |
views_attach_library_uninstall | Implements hook_uninstall(). |