mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-26 18:10:11 +00:00
Clean up code
This commit is contained in:
parent
8d714ace8d
commit
9107b7e1de
@ -9,7 +9,6 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\ExtensionHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
@ -93,8 +92,8 @@ class Com_WeblinksInstallerScript
|
||||
public function install($parent)
|
||||
{
|
||||
// Initialize a new category
|
||||
/** @type JTableCategory $category */
|
||||
$category = Table::getInstance('Category');
|
||||
/** @type Joomla\CMS\Table\Category $category */
|
||||
$category = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||
|
||||
// Check if the Uncategorised category exists before adding it
|
||||
if (!$category->load(array('extension' => 'com_weblinks', 'title' => 'Uncategorised')))
|
||||
|
@ -44,19 +44,23 @@ return new class implements ServiceProviderInterface
|
||||
{
|
||||
$container->set(AssociationExtensionInterface::class, new AssociationsHelper);
|
||||
|
||||
$container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->registerServiceProvider(new RouterFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$componentNamespace = '\\Joomla\\Component\\Weblinks';
|
||||
|
||||
$container->registerServiceProvider(new CategoryFactory($componentNamespace));
|
||||
$container->registerServiceProvider(new MVCFactory($componentNamespace));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory($componentNamespace));
|
||||
$container->registerServiceProvider(new RouterFactory($componentNamespace));
|
||||
|
||||
$container->set(
|
||||
ComponentInterface::class,
|
||||
function (Container $container) {
|
||||
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
|
||||
$component->setRegistry($container->get(Registry::class));
|
||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
||||
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
||||
$component->setAssociationExtension($container->get(AssociationExtensionInterface::class));
|
||||
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
||||
|
||||
return $component;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class WeblinkController extends FormController
|
||||
$this->checkToken();
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Weblink', '', array());
|
||||
$model = $this->getModel('Weblink', 'Administrator', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
|
||||
|
@ -128,7 +128,7 @@ class AssociationsHelper extends AssociationExtensionHelper
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$table = Table::getInstance('Category');
|
||||
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,20 @@ class CategoryModel extends ListModel
|
||||
*/
|
||||
protected $_item = null;
|
||||
|
||||
/**
|
||||
* Category left of this one
|
||||
*
|
||||
* @var CategoryNode|null
|
||||
*/
|
||||
protected $_leftsibling = null;
|
||||
|
||||
/**
|
||||
* Category right right of this one
|
||||
*
|
||||
* @var CategoryNode|null
|
||||
*/
|
||||
protected $_rightsibling = null;
|
||||
|
||||
/**
|
||||
* Array of child-categories
|
||||
*
|
||||
@ -410,7 +424,7 @@ class CategoryModel extends ListModel
|
||||
if ($hitcount)
|
||||
{
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
||||
$table = Table::getInstance('Category', 'JTable');
|
||||
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||
$table->load($pk);
|
||||
$table->hit($pk);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user