32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-11-14 00:34:06 +00:00

Fix weblinks details page

This commit is contained in:
Tuan Pham Ngoc 2021-06-20 12:49:35 +07:00
parent b318b68d07
commit 31a4a595c1
2 changed files with 11 additions and 8 deletions

View File

@ -55,7 +55,7 @@ class WeblinkModel extends ItemModel
$user = $app->getIdentity(); $user = $app->getIdentity();
if ((!$user->authorise('core.edit.state', 'com_weblinks')) && (!$user->authorise('core.edit', 'com_weblinks'))) if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
{ {
$this->setState('filter.published', 1); $this->setState('filter.published', 1);
$this->setState('filter.archived', 2); $this->setState('filter.archived', 2);

View File

@ -9,6 +9,9 @@
namespace Joomla\Component\Weblinks\Site\View\Weblink; namespace Joomla\Component\Weblinks\Site\View\Weblink;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
defined('_JEXEC') or die; defined('_JEXEC') or die;
/** /**
@ -16,7 +19,7 @@ defined('_JEXEC') or die;
* *
* @since __DEPLOY_VERSION__ * @since __DEPLOY_VERSION__
*/ */
class WeblinksViewWeblink extends JViewLegacy class HtmlView extends BaseHtmlView
{ {
protected $item; protected $item;
@ -35,7 +38,7 @@ class WeblinksViewWeblink extends JViewLegacy
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
$dispatcher = JEventDispatcher::getInstance(); $app = Factory::getApplication();
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->state = $this->get('State'); $this->state = $this->get('State');
@ -46,17 +49,17 @@ class WeblinksViewWeblink extends JViewLegacy
$offset = $this->state->get('list.offset'); $offset = $this->state->get('list.offset');
$dispatcher->trigger('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset)); $app->triggerEvent('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event = new stdClass; $item->event = new \stdClass;
$results = $dispatcher->trigger('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayTitle = trim(implode("\n", $results)); $item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->beforeDisplayContent = trim(implode("\n", $results)); $item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayContent = trim(implode("\n", $results)); $item->event->afterDisplayContent = trim(implode("\n", $results));
parent::display($tpl); parent::display($tpl);