Various fixes for category view on PHP 8

This commit is contained in:
Tuan Pham Ngoc 2021-07-09 16:02:36 +07:00
parent dffe7c53c3
commit b591407d4f
2 changed files with 5 additions and 7 deletions

View File

@ -14,7 +14,7 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.framework');
// Create a shortcut for params.
$params = &$this->item->params;
$params = &$this->category->params;
// Get the user object.
$user = JFactory::getUser();
@ -128,8 +128,8 @@ $listDirn = $this->escape($this->state->get('list.direction'));
</div>
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($tagsData); ?>
<?php $tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $tagLayout->render($tagsData); ?>
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
<?php $images = json_decode($item->images); ?>

View File

@ -61,13 +61,11 @@ class WeblinksViewCategory extends JViewCategory
parent::prepareDocument();
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
$menu = $app->getMenu()->getActive();
if ($menu)
{
@ -86,7 +84,7 @@ class WeblinksViewCategory extends JViewCategory
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1)
while ($category !== null && $category->id !== 'root' && ($menu->query['option'] != 'com_weblinks' || $id != $category->id))
{
$path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();