Stable release of v3.2.0-beta1

Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
2024-03-02 22:10:30 +02:00
parent 3c91a5cdbb
commit d1e1a56671
1786 changed files with 73608 additions and 37437 deletions

View File

@ -12,6 +12,14 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Categories\Categories;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Componentbuilder Route Helper
**/
@ -44,7 +52,7 @@ abstract class ComponentbuilderHelperRoute
}
if ($catid > 1)
{
$categories = JCategories::getInstance('componentbuilder.api');
$categories = Categories::getInstance('componentbuilder.api');
$category = $categories->get($catid);
if ($category)
{
@ -65,7 +73,7 @@ abstract class ComponentbuilderHelperRoute
/**
* Get the URL route for componentbuilder category from a category ID and language
*
* @param mixed $catid The id of the items's category either an integer id or a instance of JCategoryNode
* @param mixed $catid The id of the items's category either an integer id or a instance of CategoryNode
* @param mixed $language The id of the language being used.
*
* @return string The link to the contact
@ -74,22 +82,22 @@ abstract class ComponentbuilderHelperRoute
*/
public static function getCategoryRoute_keep_for_later($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
if ($catid instanceof CategoryNode)
{
$id = $catid->id;
$category = $catid;
$id = $catid->id;
$category = $catid;
}
else
{
throw new Exception('First parameter must be JCategoryNode');
{
throw new Exception('First parameter must be CategoryNode');
}
$views = array(
"com_componentbuilder.field" => "field",
"com_componentbuilder.fieldtype" => "fieldtype");
$view = $views[$category->extension];
if ($id < 1 || !($category instanceof JCategoryNode))
if ($id < 1 || !($category instanceof CategoryNode))
{
$link = '';
}
@ -97,20 +105,20 @@ abstract class ComponentbuilderHelperRoute
{
//Create the link
$link = 'index.php?option=com_componentbuilder&view='.$view.'&category='.$category->slug;
$needles = array(
$view => array($id),
'category' => array($id)
);
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
if ($language && $language != "*" && Multilanguage::isEnabled())
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('a.sef AS sef')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
$db->setQuery($query);
$langs = $db->loadObjectList();
foreach ($langs as $lang)
@ -122,11 +130,11 @@ abstract class ComponentbuilderHelperRoute
}
}
}
if ($item = self::_findItem($needles,'category'))
{
$link .= '&Itemid='.$item;
$link .= '&Itemid='.$item;
}
else
{
@ -152,16 +160,16 @@ abstract class ComponentbuilderHelperRoute
protected static function _findItem($needles = null,$type = null)
{
$app = JFactory::getApplication();
$app = Factory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*';
// Prepare the reverse lookup array.
if (!isset(self::$lookup[$language]))
{
self::$lookup[$language] = array();
self::$lookup[$language] = [];
$component = JComponentHelper::getComponent('com_componentbuilder');
$component = ComponentHelper::getComponent('com_componentbuilder');
$attributes = array('component_id');
$values = array($component->id);
@ -182,7 +190,7 @@ abstract class ComponentbuilderHelperRoute
if (!isset(self::$lookup[$language][$view]))
{
self::$lookup[$language][$view] = array();
self::$lookup[$language][$view] = [];
}
if (isset($item->query['id']))
@ -211,7 +219,7 @@ abstract class ComponentbuilderHelperRoute
{
if (isset(self::$lookup[$language][$view]))
{
if (ComponentbuilderHelper::checkArray($ids))
if (ArrayHelper::check($ids))
{
foreach ($ids as $id)
{
@ -232,7 +240,7 @@ abstract class ComponentbuilderHelperRoute
if ($type)
{
// Check if the global menu item has been set.
$params = JComponentHelper::getParams('com_componentbuilder');
$params = ComponentHelper::getParams('com_componentbuilder');
if ($item = $params->get($type.'_menu', 0))
{
return $item;
@ -244,7 +252,7 @@ abstract class ComponentbuilderHelperRoute
if ($active
&& $active->component == 'com_componentbuilder'
&& ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
&& ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled()))
{
return $active->id;
}