From e696659edac0bf221f0303f0bf4a2ce763731ce2 Mon Sep 17 00:00:00 2001
From: Nick Dickinson-Wilde
 <29811-NickDickinsonWilde@users.noreply.drupalcode.org>
Date: Sat, 25 Jan 2025 16:56:36 +0000
Subject: [PATCH] 3502264 fix hook inclusion

---
 entity_tasks.module            | 26 +++++++++++++-------------
 hooks/entity_tasks.theme.inc   | 15 ---------------
 hooks/entity_tasks.toolbar.inc | 13 -------------
 3 files changed, 13 insertions(+), 41 deletions(-)
 delete mode 100644 hooks/entity_tasks.theme.inc
 delete mode 100644 hooks/entity_tasks.toolbar.inc

diff --git a/entity_tasks.module b/entity_tasks.module
index f105842..0720291 100644
--- a/entity_tasks.module
+++ b/entity_tasks.module
@@ -2,21 +2,21 @@
 
 /**
  * @file
- * Autoload includes folder.
+ * Entity Tasks hooks.
  */
 
-$moduleName = basename(dirname(__FILE__));
+use Drupal\Component\Serialization\Yaml;
 
-$current_module_path = \Drupal::service('extension.list.module')->getPath($moduleName);
-$pathsToInclude = glob($current_module_path . '/hooks/*');
+/**
+ * Implements hook_toolbar().
+ */
+function entity_tasks_toolbar_alter(&$items) {
+  \Drupal::service('entity_tasks.toolbar')->buildToolbarConfiguration($items);
+}
 
-if ($pathsToInclude) {
-  $module_handler = \Drupal::service('module_handler');
-  foreach ($pathsToInclude as $path) {
-    $pathInfo = pathinfo($path);
-    $directory = str_replace($current_module_path, '', $pathInfo['dirname']);
-    if (isset($pathInfo['extension'])) {
-      $module_handler->loadInclude($moduleName, $pathInfo['extension'], $directory . '/' . $pathInfo['filename']);
-    }
-  }
+/**
+ * Implements hook_theme().
+ */
+function entity_tasks_theme($existing, $type, $theme, $path) {
+  return Yaml::decode(file_get_contents(DRUPAL_ROOT . '/' . $path . '/' . $theme . '.themes.yml'));
 }
diff --git a/hooks/entity_tasks.theme.inc b/hooks/entity_tasks.theme.inc
deleted file mode 100644
index 4ebd364..0000000
--- a/hooks/entity_tasks.theme.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-/**
- * @file
- * Theme hook.
- */
-
-use Drupal\Component\Serialization\Yaml;
-
-/**
- * Implements hook_theme().
- */
-function entity_tasks_theme($existing, $type, $theme, $path) {
-  return Yaml::decode(file_get_contents(DRUPAL_ROOT . '/' . $path . '/' . $theme . '.themes.yml'));
-}
diff --git a/hooks/entity_tasks.toolbar.inc b/hooks/entity_tasks.toolbar.inc
deleted file mode 100644
index 02e2115..0000000
--- a/hooks/entity_tasks.toolbar.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-/**
- * @file
- * Toolbar hook.
- */
-
-/**
- * Implements hook_toolbar().
- */
-function entity_tasks_toolbar_alter(&$items) {
-  \Drupal::service('entity_tasks.toolbar')->buildToolbarConfiguration($items);
-}
-- 
GitLab