You are here

function mobile_device_detection_install in Mobile Device Detection 8

Same name and namespace in other branches
  1. 8.3 mobile_device_detection.install \mobile_device_detection_install()
  2. 8.2 mobile_device_detection.install \mobile_device_detection_install()

Implements hook_install().

File

./mobile_device_detection.module, line 30

Code

function mobile_device_detection_install() {

  // Enable mobile_device_detection plugin.
  $config = \Drupal::service('config.factory')
    ->getEditable('views.settings');
  $display_extenders = $config
    ->get('display_extenders') ?: array();
  $display_extenders[] = 'mobile_device_detection';
  $config
    ->set('display_extenders', $display_extenders);
  $config
    ->save();
}