function onAfterRoute() { /* Do nothing on back end or if format is not html */ if ($this->_app->isAdmin() || $this->_view != 'html') { return true; } /* Get active menu id */ $menuActive = $this->_app->getMenu()->getActive(); if (!$menuActive) { return; } $id = $menuActive->id; if ($id) { /* Load RSTBox Helper class */ JLoader::register('RstboxHelper', JPATH_ADMINISTRATOR . '/components/com_rstbox/helpers/rstbox.php'); $user = JFactory::getUser(); /* Get all boxes based on active menu id & user authorised view levels */ $boxes = RstboxHelper::getBoxes($id, $user->getAuthorisedViewLevels()); /* Check if is there at least one box and then load css and js files */ if ($boxes) { if (!$this->_params->get("forceloadmedia", false)) { RstboxHelper::loadassets_front(); } /* Prepare HTML */ $html = RstboxHelper::renderLayout("rstbox", $boxes); self::$boxesHTML = $html; } } }