+ protected function executePageHooks(string $hook, array &$data, string $template = null): void
+ {
+ $this->container->pluginManager->executeHooks(
+ $hook,
+ $data,
+ $this->buildPluginParameters($template)
+ );
+ }
+
+ protected function buildPluginParameters(?string $template): array
+ {
+ return [
+ 'target' => $template,
+ 'loggedin' => $this->container->loginManager->isLoggedIn(),
+ 'basePath' => $this->container->basePath,
+ 'rootPath' => preg_replace('#/index\.php$#', '', $this->container->basePath),
+ 'bookmarkService' => $this->container->bookmarkService
+ ];
+ }
+
+ /**
+ * Simple helper which prepend the base path to redirect path.
+ *
+ * @param Response $response
+ * @param string $path Absolute path, e.g.: `/`, or `/admin/shaare/123` regardless of install directory
+ *
+ * @return Response updated
+ */
+ protected function redirect(Response $response, string $path): Response
+ {
+ return $response->withRedirect($this->container->basePath . $path);
+ }
+