digitalpoint
Well-known member
There are times I want to modify a Model, but only when on certain pages (for example adding a JOIN to the thread model, but only when viewing an individual thread).
So I wanted to use my listener to only extend the class if we are on a certain page. Now I know I can use the $GLOBALS['fc'] object to do it, but it makes me cringe a bit doing it that way.
Is there some static function for getting the current controller I'm missing?
This works, but... blah... lol
So I wanted to use my listener to only extend the class if we are on a certain page. Now I know I can use the $GLOBALS['fc'] object to do it, but it makes me cringe a bit doing it that way.
Is there some static function for getting the current controller I'm missing?
This works, but... blah... lol
PHP:
if ($GLOBALS['fc']->route()->getControllerName() === 'XenForo_ControllerPublic_Thread') ...