From 97a4469b6f156b7ad1c5699b105badb748a63495 Mon Sep 17 00:00:00 2001 From: Serge Rodovnichenko Date: Tue, 2 Jul 2019 13:06:08 +0300 Subject: [PATCH 1/2] Add frontend hooks for pages Frontend hooks `frontend_page.before_content` and `frontend_page.after_content` for any application that inherits `waPage` for their static pages --- wa-system/page/actions/waPage.action.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wa-system/page/actions/waPage.action.php b/wa-system/page/actions/waPage.action.php index 13f555efa..1327be28f 100644 --- a/wa-system/page/actions/waPage.action.php +++ b/wa-system/page/actions/waPage.action.php @@ -74,6 +74,9 @@ public function execute() $this->view->assign('page', $page); $this->view->assign('wa_theme_url', $this->getThemeUrl()); + + $this->view->assign('frontend_page', wa($this->getAppId())->event('frontend_page', $page, array('before_content', 'after_content'))); + $page['content'] = $this->renderPage($page); if ($this->layout) { @@ -123,4 +126,4 @@ protected function getPageModel() } return new $this->model(); } -} \ No newline at end of file +} From a0064d2353eaacd1895270ac3e300d785f502469 Mon Sep 17 00:00:00 2001 From: Serge Rodovnichenko Date: Tue, 2 Jul 2019 13:09:51 +0300 Subject: [PATCH 2/2] Call `frontend_page` hook from Site app too --- wa-apps/site/lib/actions/frontend/siteFrontend.action.php | 1 + 1 file changed, 1 insertion(+) diff --git a/wa-apps/site/lib/actions/frontend/siteFrontend.action.php b/wa-apps/site/lib/actions/frontend/siteFrontend.action.php index 807e0b13e..88a6f24b7 100755 --- a/wa-apps/site/lib/actions/frontend/siteFrontend.action.php +++ b/wa-apps/site/lib/actions/frontend/siteFrontend.action.php @@ -13,6 +13,7 @@ public function execute() } } $this->view->getHelper()->globals($params); + $this->view->assign('frontend_page', wa('site')->event('frontend_page', $page, array('before_content', 'after_content'))); $this->view->assign('page', $page); $this->view->assign('wa_theme_url', $this->getThemeUrl()); $page['content'] = $this->renderPage($page);