Stable release of v4.0.0-alpha1

First alpha release of Component Builder towards Joomla 4 (very unstable...).
This commit is contained in:
2024-03-09 21:47:28 +02:00
parent 3c91a5cdbb
commit c660bb6280
3040 changed files with 296304 additions and 269820 deletions

View File

@ -3,8 +3,8 @@
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
@ -17,6 +17,13 @@ defined('_JEXEC') or die('Restricted access');
// 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;
/**
* ###Component### Route Helper
**/
@ -27,7 +34,7 @@ abstract class ###Component###HelperRoute
/**
* Get the URL route for ###component### 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
@ -36,20 +43,20 @@ abstract class ###Component###HelperRoute
*/
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(###ROUTER_CATEGORY_VIEWS###);
$view = $views[$category->extension];
if ($id < 1 || !($category instanceof JCategoryNode))
if ($id < 1 || !($category instanceof CategoryNode))
{
$link = '';
}
@ -57,20 +64,20 @@ abstract class ###Component###HelperRoute
{
//Create the link
$link = 'index.php?option=com_###component###&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)
@ -82,11 +89,11 @@ abstract class ###Component###HelperRoute
}
}
}
if ($item = self::_findItem($needles,'category'))
{
$link .= '&Itemid='.$item;
$link .= '&Itemid='.$item;
}
else
{
@ -112,16 +119,16 @@ abstract class ###Component###HelperRoute
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_###component###');
$component = ComponentHelper::getComponent('com_###component###');
$attributes = array('component_id');
$values = array($component->id);
@ -142,7 +149,7 @@ abstract class ###Component###HelperRoute
if (!isset(self::$lookup[$language][$view]))
{
self::$lookup[$language][$view] = array();
self::$lookup[$language][$view] = [];
}
if (isset($item->query['id']))
@ -171,7 +178,7 @@ abstract class ###Component###HelperRoute
{
if (isset(self::$lookup[$language][$view]))
{
if (###Component###Helper::checkArray($ids))
if (Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($ids))
{
foreach ($ids as $id)
{
@ -192,7 +199,7 @@ abstract class ###Component###HelperRoute
if ($type)
{
// Check if the global menu item has been set.
$params = JComponentHelper::getParams('com_###component###');
$params = ComponentHelper::getParams('com_###component###');
if ($item = $params->get($type.'_menu', 0))
{
return $item;
@ -204,7 +211,7 @@ abstract class ###Component###HelperRoute
if ($active
&& $active->component == 'com_###component###'
&& ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
&& ($language == '*' || in_array($active->language, array('*', $language)) || !Multilanguage::isEnabled()))
{
return $active->id;
}