blob: 91edfa9aabc957df2e9309f9ed014b1ffc919030 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
/**
* @file
*/
/**
* Implements hook_preprocess_HOOK() for block templates.
*/
function help_preprocess_block(&$variables) {
if ($variables['plugin_id'] == 'help_block') {
$variables['attributes']['role'] = 'complementary';
}
}
/**
* Ensure that search is updated when extensions are installed or uninstalled.
*
* @param string[] $extensions
* (optional) If modules are being uninstalled, the names of the modules
* being uninstalled. For themes being installed/uninstalled, or modules
* being installed, omit this parameter.
*/
function _help_search_update(array $extensions = []): void {
// Early return if search is not installed or if we're uninstalling this
// module.
if (!\Drupal::hasService('plugin.manager.search') ||
in_array('help', $extensions)) {
return;
}
// Ensure that topics for extensions that have been uninstalled are removed
// and that the index state variable is updated.
$help_search = \Drupal::service('plugin.manager.search')->createInstance('help_search');
$help_search->updateTopicList();
$help_search->updateIndexState();
}
|