diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index d2fb2d4..8900845 100755 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -19,6 +19,6 @@ jobs: uses: actions/checkout@master - name: Compress Images - uses: calibreapp/image-actions@master + uses: calibreapp/image-actions@main with: githubToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 9cc34bf..9122cf4 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -149,4 +149,15 @@ return [ ], ], ], + '^.*/admin/module/hook/list\?.*$' => [ + [ + 'dest' => '\Modules\Admin\Controller\BackendController:viewModuleHookList', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::MODULE, + ], + ], + ], ]; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 57774c6..f5189ed 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -442,6 +442,47 @@ final class BackendController extends Controller return $view; } + /** + * Method which generates the module profile view. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Response can be rendered + * + * @since 1.0.0 + */ + public function viewModuleHookList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Admin/Theme/Backend/modules-hook-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response)); + + $module = $request->getData('id') ?? ''; + $view->setData('module', $module); + + $appPath = __DIR__ . '/../../../Web'; + $activeHooks = []; + + $apps = \scandir($appPath); + if ($apps === false) { + $apps = []; + } + + foreach ($apps as $app) { + if (!\is_file(__DIR__ . '/../../../Web/' . $app . '/Hooks.php')) { + continue; + } + + $activeHooks[$app] = include __DIR__ . '/../../../Web/' . $app . '/Hooks.php'; + } + + $view->setData('hooks', $activeHooks); + + return $view; + } + /** * Method which generates the module profile view. * diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 0e09e55..eb3a1a1 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -162,6 +162,7 @@ return ['Admin' => [ 'Uppercase' => 'Uppercase', 'Username' => 'Username', 'Value' => 'Value', + 'Verb' => 'Verb', 'Version' => 'Version', 'VeryFast' => 'Very Fast', 'VeryHeavy' => 'Very Heavy', diff --git a/Theme/Backend/modules-hook-list.tpl.php b/Theme/Backend/modules-hook-list.tpl.php new file mode 100644 index 0000000..8678040 --- /dev/null +++ b/Theme/Backend/modules-hook-list.tpl.php @@ -0,0 +1,109 @@ +getData('hooks') ?? []; +$module = $this->getData('module') ?? ''; + +echo $this->getData('nav')->render(); +?> + +
+
+
+
getHtml('Hooks'); ?>
+
+ + + + + + $appHooks) : + foreach ($appHooks as $uri => $destinations) : + foreach ($destinations as $route) : + if (\stripos($route['dest'], '\Modules\\' . $module . '\Controller') === false) { + continue; + } + + ++$c; + ?> + + +
+
+
diff --git a/Theme/Backend/modules-route-list.tpl.php b/Theme/Backend/modules-route-list.tpl.php index 9137b46..14448e8 100644 --- a/Theme/Backend/modules-route-list.tpl.php +++ b/Theme/Backend/modules-route-list.tpl.php @@ -13,6 +13,7 @@ declare(strict_types=1); use phpOMS\Message\Http\HttpHeader; +use phpOMS\Router\RouteVerb; /** * @var \phpOMS\Views\View $this @@ -44,6 +45,18 @@ echo $this->getData('nav')->render(); + getHtml('Verb'); ?> + + + getHtml('Route'); ?> +