protected function _getViewHtml($context, &$article, $params, $layout = null) { list($extension, $vName) = explode('.', $context); $input = JFactory::getApplication()->input; $addon_id = $input->getInt('addon_id'); $addon = TZ_Portfolio_PlusPluginHelper::getPlugin($this->_type, $this->_name); if (!$addon_id || $addon_id && $addon_id == $addon->id) { tzportfolioplusimport('controller.legacy'); $result = true; // Check task with format: addon_name.addon_view.addon_task (example image.default.display); $adtask = $input->get('addon_task'); if ($adtask && strpos($adtask, '.') > 0 && !$addon_id) { list($plgname, $adtask) = explode('.', $adtask, 2); if ($plgname == $this->_name) { $result = true; $input->set('addon_task', $adtask); } else { $result = false; } } if ($result && ($controller = TZ_Portfolio_Plus_AddOnControllerLegacy::getInstance('PlgTZ_Portfolio_Plus' . ucfirst($this->_type) . ucfirst($this->_name), array('base_path' => COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . $this->_type . DIRECTORY_SEPARATOR . $this->_name)))) { tzportfolioplusimport('plugin.modelitem'); $controller->set('addon', $addon); $controller->set('article', $article); $controller->set('trigger_params', $params); $task = $input->get('addon_task'); if (!$task && !$addon_id) { $input->set('addon_view', $vName); $input->set('addon_layout', 'default'); if ($layout) { $input->set('addon_layout', $layout); } } $html = null; try { ob_start(); $controller->execute($task); $controller->redirect(); $html = ob_get_contents(); ob_end_clean(); } catch (Exception $e) { if ($e->getMessage()) { JFactory::getApplication()->enqueueMessage('Addon ' . $this->_name . ': ' . $e->getMessage(), 'warning'); } } if ($html) { $html = trim($html); } $input->set('addon_task', null); return $html; } } }