-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.1] Convert mod_multilangstatus to service provider (#42845)
- Loading branch information
1 parent
f8003bc
commit 35fc16b
Showing
4 changed files
with
86 additions
and
21 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
administrator/modules/mod_multilangstatus/mod_multilangstatus.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
administrator/modules/mod_multilangstatus/services/provider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage mod_multilangstatus | ||
* | ||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
\defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Extension\Service\Provider\Module; | ||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory; | ||
use Joomla\DI\Container; | ||
use Joomla\DI\ServiceProviderInterface; | ||
|
||
/** | ||
* The multilanguage status module service provider. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
return new class () implements ServiceProviderInterface { | ||
/** | ||
* Registers the service provider with a DI container. | ||
* | ||
* @param Container $container The DI container. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function register(Container $container) | ||
{ | ||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\MultilangStatus')); | ||
|
||
$container->registerServiceProvider(new Module()); | ||
} | ||
}; |
44 changes: 44 additions & 0 deletions
44
administrator/modules/mod_multilangstatus/src/Dispatcher/Dispatcher.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage mod_multilangstatus | ||
* | ||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
namespace Joomla\Module\MultilangStatus\Administrator\Dispatcher; | ||
|
||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher; | ||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Language\Multilanguage; | ||
use Joomla\Database\DatabaseInterface; | ||
|
||
// phpcs:disable PSR1.Files.SideEffects | ||
\defined('_JEXEC') or die; | ||
// phpcs:enable PSR1.Files.SideEffects | ||
|
||
/** | ||
* Dispatcher class for mod_multilangstatus | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class Dispatcher extends AbstractModuleDispatcher | ||
{ | ||
/** | ||
* Returns the layout data. | ||
* | ||
* @return array | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function getLayoutData() | ||
{ | ||
$data = parent::getLayoutData(); | ||
|
||
$data['multilanguageEnabled'] = Multilanguage::isEnabled($this->getApplication(), Factory::getContainer()->get(DatabaseInterface::class)); | ||
|
||
return $data; | ||
} | ||
} |