32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-11-11 15:51:05 +00:00

Improve smart search plugin, make it works in the same way with other core plugins

This commit is contained in:
Tuan Pham Ngoc 2022-09-03 16:38:05 +07:00
parent 3f15c60950
commit 53578a124a

View File

@ -9,6 +9,7 @@
defined('JPATH_BASE') or die;
use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\Component\Finder\Administrator\Indexer\Adapter;
use Joomla\Component\Finder\Administrator\Indexer\Helper;
@ -255,13 +256,8 @@ class PlgFinderWeblinks extends Adapter
$item->setLanguage();
// Initialise the item parameters.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry;
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry;
$item->params = new Registry($item->params);
$item->metadata = new Registry($item->metadata);
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
@ -289,7 +285,16 @@ class PlgFinderWeblinks extends Adapter
$item->addTaxonomy('Type', 'Web Link');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $this->translateState($item->cat_state), $item->cat_access);
$categories = Categories::getInstance('com_weblinks', ['published' => false, 'access' => false]);
$category = $categories->get($item->catid);
// Category does not exist, stop here
if (!$category)
{
return;
}
$item->addNestedTaxonomy('Category', $category, $this->translateState($category->published), $category->access, $category->language);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);