From f499b9ee7b2c085f142fc5e12424f54be004e16e Mon Sep 17 00:00:00 2001 From: Tuan Pham Ngoc Date: Sun, 20 Jun 2021 18:40:26 +0700 Subject: [PATCH] Start supporting Multilingual Associations --- .../components/com_weblinks/services/provider.php | 5 +++++ .../com_weblinks/src/Helper/AssociationsHelper.php | 2 +- .../components/com_weblinks/src/Model/WeblinkModel.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/administrator/components/com_weblinks/services/provider.php b/src/administrator/components/com_weblinks/services/provider.php index 059bde7..71ff945 100644 --- a/src/administrator/components/com_weblinks/services/provider.php +++ b/src/administrator/components/com_weblinks/services/provider.php @@ -8,6 +8,7 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\Association\AssociationExtensionInterface; use Joomla\CMS\Categories\CategoryFactoryInterface; use Joomla\CMS\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; @@ -19,6 +20,7 @@ use Joomla\CMS\Extension\Service\Provider\RouterFactory; use Joomla\CMS\HTML\Registry; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\Component\Weblinks\Administrator\Extension\WeblinksComponent; +use Joomla\Component\Weblinks\Administrator\Helper\AssociationsHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; @@ -40,6 +42,8 @@ return new class implements ServiceProviderInterface */ public function register(Container $container) { + $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')); @@ -52,6 +56,7 @@ return new class implements ServiceProviderInterface $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); $component->setRouterFactory($container->get(RouterFactoryInterface::class)); + $component->setAssociationExtension($container->get(AssociationExtensionInterface::class)); return $component; } diff --git a/src/administrator/components/com_weblinks/src/Helper/AssociationsHelper.php b/src/administrator/components/com_weblinks/src/Helper/AssociationsHelper.php index cb20684..c6de31a 100644 --- a/src/administrator/components/com_weblinks/src/Helper/AssociationsHelper.php +++ b/src/administrator/components/com_weblinks/src/Helper/AssociationsHelper.php @@ -21,7 +21,7 @@ use Joomla\Component\Weblinks\Site\Helper\AssociationHelper; * * @since __DEPLOY_VERSION__ */ -class WeblinksAssociationsHelper extends AssociationExtensionHelper +class AssociationsHelper extends AssociationExtensionHelper { /** * The extension name diff --git a/src/administrator/components/com_weblinks/src/Model/WeblinkModel.php b/src/administrator/components/com_weblinks/src/Model/WeblinkModel.php index f1bb98a..89a0f2a 100644 --- a/src/administrator/components/com_weblinks/src/Model/WeblinkModel.php +++ b/src/administrator/components/com_weblinks/src/Model/WeblinkModel.php @@ -391,7 +391,7 @@ class WeblinkModel extends AdminModel // Association weblinks items if (Associations::isEnabled()) { - $languages = LanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + $languages = LanguageHelper::getContentLanguages(false, false, null, 'ordering', 'asc'); if (count($languages) > 1) {