blob: f72877c04e430799e7e1e4239c5c60239bf41483 (
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
38
39
|
<?php
declare(strict_types=1);
namespace Drupal\navigation\Hook;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\Requirement\RequirementSeverity;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
* Requirements for the navigation module.
*/
class NavigationRequirements {
use StringTranslationTrait;
public function __construct(
protected readonly ModuleHandlerInterface $moduleHandler,
) {}
/**
* Implements hook_runtime_requirements().
*/
#[Hook('runtime_requirements')]
public function runtime(): array {
$requirements = [];
if ($this->moduleHandler->moduleExists('toolbar')) {
$requirements['toolbar'] = [
'title' => $this->t('Toolbar and Navigation modules are both installed'),
'value' => $this->t('The Navigation module is a complete replacement for the Toolbar module and disables its functionality when both modules are installed. If you are planning to continue using Navigation module, you can uninstall the Toolbar module now.'),
'severity' => RequirementSeverity::Warning,
];
}
return $requirements;
}
}
|