forked from meta-systems/click_admin_menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclick_admin_menu.install
More file actions
24 lines (21 loc) · 970 Bytes
/
click_admin_menu.install
File metadata and controls
24 lines (21 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
* Implements hook_install().
*
*/
function click_admin_menu_install() {
$content = file_get_contents(__DIR__.'/config/hook/block.block.metasystems_clickadminmenu.yml');
$data = \Symfony\Component\Yaml\Yaml::parse($content);
$data['theme'] = \Drupal::service('theme.manager')->getActiveTheme()->getName();
$config = \Drupal::service('config.factory')->getEditable('block.block.metasystems_clickadminmenu');
$config->setData($data)->save();
/**
* Shortcut settings for a theme
* @see https://drupal.stackexchange.com/questions/256197/d8-i-changed-my-administration-theme-and-now-the-shortcut-button-isnt-visible
*/
$shortcut_settings_key = 'third_party_settings.shortcut.module_link';
$theme_settings = \Drupal::configFactory()->getEditable($data['theme'].'.settings');
if(!$theme_settings->get($shortcut_settings_key)) {
$theme_settings->set($shortcut_settings_key, TRUE)->save(TRUE);
}
}