mobile_device_detection.install in Mobile Device Detection 8.2
Same filename and directory in other branches
Default install and uninstall functions which set up default data.
File
mobile_device_detection.installView source
<?php
/**
* @file
* Default install and uninstall functions which set up default data.
*/
/**
* Implements hook_install().
*/
function mobile_device_detection_install() {
// Enable mobile_device_detection plugin.
$config = \Drupal::service('config.factory')
->getEditable('views.settings');
$display_extenders = $config
->get('display_extenders') ?: [];
$display_extenders[] = 'mobile_device_detection';
$config
->set('display_extenders', $display_extenders);
$config
->save();
}
/**
* Implements hook_uninstall().
*/
function mobile_device_detection_uninstall() {
// Disable mobile_device_detection plugin.
$config = \Drupal::service('config.factory')
->getEditable('views.settings');
$display_extenders = $config
->get('display_extenders') ?: [];
$key = array_search('mobile_device_detection', $display_extenders);
if ($key !== FALSE) {
unset($display_extenders[$key]);
$config
->set('display_extenders', $display_extenders);
$config
->save();
}
}
Functions
Name | Description |
---|---|
mobile_device_detection_install | Implements hook_install(). |
mobile_device_detection_uninstall | Implements hook_uninstall(). |