File tree Expand file tree Collapse file tree 2 files changed +27
-23
lines changed
contrib/extensions/joomla/event/subscriber Expand file tree Collapse file tree 2 files changed +27
-23
lines changed Original file line number Diff line number Diff line change @@ -16,32 +16,12 @@ protected function _beforeSend(KDispatcherContextInterface $context)
1616
1717 if (!$ response ->isDownloadable () && !$ response ->isRedirect () && $ request ->getFormat () == 'html ' )
1818 {
19- $ decorator = $ this ->getDecorator ();
20-
21- //Set metadata in Joomla document
22- if ($ decorator == 'joomla ' )
23- {
24- //Set the title
25- if ($ title = $ this ->getController ()->getView ()->getTitle ()) {
26- JFactory::getDocument ()->setTitle ($ title );
27- }
28-
29- //Set the direction
30- if ($ direction = $ this ->getController ()->getView ()->getDirection ()) {
31- JFactory::getDocument ()->setDirection ($ direction );
32- }
33-
34- //Set the language
35- if ($ language = $ this ->getController ()->getView ()->getLanguage ()) {
36- JFactory::getDocument ()->setLanguage ($ language );
37- }
38- }
39-
4019 $ controller = $ this ->getObject ('com:koowa.controller.page ' , array ('response ' => $ response ));
4120
4221 //Configure the page view
4322 $ controller ->getView ()
44- ->setDecorator ($ decorator )
23+ ->setDecorator ($ this ->getDecorator ())
24+ ->setDecorator ($ this ->getDecorator ())
4525 ->setLayout ($ this ->getLayout ());
4626
4727 //Set the result in the response
Original file line number Diff line number Diff line change @@ -114,7 +114,6 @@ public function onAfterApplicationInitialise(KEventInterface $event)
114114 }
115115 }
116116
117-
118117 public function onAfterApplicationRoute (KEventInterface $ event )
119118 {
120119 $ dispatcher = $ this ->getDispatcher ();
@@ -231,6 +230,29 @@ public function onBeforeDispatcherDispatch(KEventInterface $event)
231230 }
232231 }
233232
233+ public function onBeforeKoowaPageControllerRender (KEventInterface $ event )
234+ {
235+ $ dispatcher = $ this ->getDispatcher ();
236+
237+ if ($ dispatcher ->getDecorator () == 'joomla ' )
238+ {
239+ //Set the title
240+ if ($ title = $ dispatcher ->getController ()->getView ()->getTitle ()) {
241+ JFactory::getDocument ()->setTitle ($ title );
242+ }
243+
244+ //Set the direction
245+ if ($ direction = $ dispatcher ->getController ()->getView ()->getDirection ()) {
246+ JFactory::getDocument ()->setDirection ($ direction );
247+ }
248+
249+ //Set the language
250+ if ($ language = $ dispatcher ->getController ()->getView ()->getLanguage ()) {
251+ JFactory::getDocument ()->setLanguage ($ language );
252+ }
253+ }
254+ }
255+
234256 public function onAfterApplicationDispatch (KEventInterface $ event )
235257 {
236258 if ($ this ->isDispatchable ())
@@ -274,6 +296,8 @@ public function onAfterApplicationDispatch(KEventInterface $event)
274296 }
275297 }
276298
299+
300+
277301 public function onAfterApplicationRender (KEventInterface $ event )
278302 {
279303 if (!headers_sent ())
You can’t perform that action at this time.
0 commit comments