summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/help
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/help')
-rw-r--r--core/modules/help/help.module9
-rw-r--r--core/modules/help/src/HelpTopicTwigLoader.php2
-rw-r--r--core/modules/help/src/HelpTwigExtension.php2
-rw-r--r--core/modules/help/src/Hook/HelpThemeHooks.php25
-rw-r--r--core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigExtension.php2
-rw-r--r--core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php2
-rw-r--r--core/modules/help/tests/src/Unit/HelpTopicTwigTest.php6
7 files changed, 32 insertions, 16 deletions
diff --git a/core/modules/help/help.module b/core/modules/help/help.module
index 69ab53e1436..17cb448e221 100644
--- a/core/modules/help/help.module
+++ b/core/modules/help/help.module
@@ -5,15 +5,6 @@
*/
/**
- * Implements hook_preprocess_HOOK() for block templates.
- */
-function help_preprocess_block(&$variables): void {
- if ($variables['plugin_id'] == 'help_block') {
- $variables['attributes']['role'] = 'complementary';
- }
-}
-
-/**
* Ensure that search is updated when extensions are installed or uninstalled.
*
* @param string[] $extensions
diff --git a/core/modules/help/src/HelpTopicTwigLoader.php b/core/modules/help/src/HelpTopicTwigLoader.php
index fc2e61bbaaf..9178166597c 100644
--- a/core/modules/help/src/HelpTopicTwigLoader.php
+++ b/core/modules/help/src/HelpTopicTwigLoader.php
@@ -96,7 +96,7 @@ class HelpTopicTwigLoader extends FilesystemLoader {
/**
* {@inheritdoc}
*/
- protected function findTemplate($name, $throw = TRUE) {
+ protected function findTemplate($name, $throw = TRUE): ?string {
if (!str_ends_with($name, '.html.twig')) {
if (!$throw) {
return NULL;
diff --git a/core/modules/help/src/HelpTwigExtension.php b/core/modules/help/src/HelpTwigExtension.php
index e41ad66503d..b8a77a914f6 100644
--- a/core/modules/help/src/HelpTwigExtension.php
+++ b/core/modules/help/src/HelpTwigExtension.php
@@ -41,7 +41,7 @@ class HelpTwigExtension extends AbstractExtension {
/**
* {@inheritdoc}
*/
- public function getFunctions() {
+ public function getFunctions(): array {
return [
new TwigFunction('help_route_link', [$this, 'getRouteLink']),
new TwigFunction('help_topic_link', [$this, 'getTopicLink']),
diff --git a/core/modules/help/src/Hook/HelpThemeHooks.php b/core/modules/help/src/Hook/HelpThemeHooks.php
new file mode 100644
index 00000000000..431c7d089d2
--- /dev/null
+++ b/core/modules/help/src/Hook/HelpThemeHooks.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\help\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for help.
+ */
+class HelpThemeHooks {
+ /**
+ * @file
+ */
+
+ /**
+ * Implements hook_preprocess_HOOK() for block templates.
+ */
+ #[Hook('preprocess_block')]
+ public function preprocessBlock(&$variables): void {
+ if ($variables['plugin_id'] == 'help_block') {
+ $variables['attributes']['role'] = 'complementary';
+ }
+ }
+
+}
diff --git a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigExtension.php b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigExtension.php
index f54e15e882a..abe16ebdb48 100644
--- a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigExtension.php
+++ b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigExtension.php
@@ -14,7 +14,7 @@ class HelpTestTwigExtension extends AbstractExtension {
/**
* {@inheritdoc}
*/
- public function getNodeVisitors() {
+ public function getNodeVisitors(): array {
return [
new HelpTestTwigNodeVisitor(),
];
diff --git a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
index 953f2aa2ce4..9c53a2e0cf3 100644
--- a/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
+++ b/core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php
@@ -97,7 +97,7 @@ class HelpTestTwigNodeVisitor implements NodeVisitorInterface {
/**
* {@inheritdoc}
*/
- public function getPriority() {
+ public function getPriority(): int {
return -100;
}
diff --git a/core/modules/help/tests/src/Unit/HelpTopicTwigTest.php b/core/modules/help/tests/src/Unit/HelpTopicTwigTest.php
index 1e182076608..13e6bdffda1 100644
--- a/core/modules/help/tests/src/Unit/HelpTopicTwigTest.php
+++ b/core/modules/help/tests/src/Unit/HelpTopicTwigTest.php
@@ -6,8 +6,8 @@ namespace Drupal\Tests\help\Unit;
use Drupal\Core\Cache\Cache;
use Drupal\help\HelpTopicTwig;
-use Drupal\Tests\Core\Template\StubTwigTemplate;
use Drupal\Tests\UnitTestCase;
+use Twig\Template;
use Twig\TemplateWrapper;
/**
@@ -101,8 +101,8 @@ class HelpTopicTwigTest extends UnitTestCase {
->getMock();
$template = $this
- ->getMockBuilder(StubTwigTemplate::class)
- ->onlyMethods(['render'])
+ ->getMockBuilder(Template::class)
+ ->onlyMethods(['render', 'getTemplateName', 'getDebugInfo', 'getSourceContext', 'doDisplay'])
->setConstructorArgs([$twig])
->getMock();