|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Drupal\user\Entity\User; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @file |
|
7
|
|
|
* Contains core functionality for the DF distribution. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Implements hook_module_implements_alter(). |
|
12
|
|
|
* |
|
13
|
|
|
* @todo Remove after #2635978 is fixed. |
|
14
|
|
|
*/ |
|
15
|
|
|
function df_core_module_implements_alter(&$implementations, $hook) { |
|
16
|
|
|
// Disable block initialization/inheritance for themes enabled after Lightning |
|
17
|
|
|
// is installed in order to prevent blocks associated with the profile from |
|
18
|
|
|
// bleeding over into scenarios. |
|
19
|
|
|
if ($hook == 'themes_installed') { |
|
20
|
|
|
unset($implementations['block']); |
|
21
|
|
|
} |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Implements hook_menu_local_tasks_alter(). |
|
26
|
|
|
*/ |
|
27
|
|
|
function df_core_menu_local_tasks_alter(&$data, $route_name) { |
|
|
|
|
|
|
28
|
|
|
// Core doesn't currently clean up local tasks created via Views when the View |
|
29
|
|
|
// is disabled/deleted. Remove the core file listing view's local tasks in |
|
30
|
|
|
// order to prevent duplicate 'Files' tabs from appear on admin/content. |
|
31
|
|
|
// @todo: remove this when https://www.drupal.org/node/2027043 is fixed. |
|
32
|
|
|
if (!empty($data['tabs'])) { |
|
33
|
|
|
foreach ($data['tabs'] as $tab_level => $tabs) { |
|
34
|
|
|
foreach ($tabs as $href => $tab_data) { |
|
35
|
|
|
if ($href == 'views_view:view.files.page_1') { |
|
36
|
|
|
$data['tabs'][$tab_level][$href]['#access'] = FALSE; |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Implements hook_requirements(). |
|
45
|
|
|
*/ |
|
46
|
|
|
function df_requirements($phase) { |
|
47
|
|
|
$requirements = []; |
|
48
|
|
|
if (phpversion() < '7.1') { |
|
49
|
|
|
$requirements['df_requirements'] = [ |
|
50
|
|
|
'title' => t('DEMO FRAMEWORK REQUIREMENTS'), |
|
51
|
|
|
'value' => t("Your PHP installation is too old."), |
|
52
|
|
|
'description' => t("This build requires your cloud env to run PHP7.1+"), |
|
53
|
|
|
'severity' => REQUIREMENT_ERROR, |
|
54
|
|
|
]; |
|
55
|
|
|
} |
|
56
|
|
|
if ($phase == 'runtime') { |
|
57
|
|
|
$requirements['df_version'] = [ |
|
58
|
|
|
'title' => t("Demo Framework"), |
|
59
|
|
|
'value' => t( "4.0.9"), |
|
60
|
|
|
'description' => 'Last Update: 2020-09-08', |
|
61
|
|
|
'severity' => REQUIREMENT_INFO, |
|
62
|
|
|
]; |
|
63
|
|
|
} |
|
64
|
|
|
return $requirements; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.