32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2025-01-12 07:55:53 +00:00

Start supporting Multilingual Associations

This commit is contained in:
Tuan Pham Ngoc 2021-06-20 18:40:26 +07:00
parent 0c4a9ce8b5
commit f499b9ee7b
3 changed files with 7 additions and 2 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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)
{