diff --git a/plugins/task/demotasks/demotasks.xml b/plugins/task/demotasks/demotasks.xml index 158fb8042ad07..d8d11512f983a 100644 --- a/plugins/task/demotasks/demotasks.xml +++ b/plugins/task/demotasks/demotasks.xml @@ -9,9 +9,10 @@ www.joomla.org 4.1 PLG_TASK_DEMO_TASKS_XML_DESCRIPTION + Joomla\Plugin\Task\DemoTasks - demotasks.php - language + services + src forms diff --git a/plugins/task/demotasks/services/provider.php b/plugins/task/demotasks/services/provider.php new file mode 100644 index 0000000000000..f7a6f92cc6c3f --- /dev/null +++ b/plugins/task/demotasks/services/provider.php @@ -0,0 +1,49 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +defined('_JEXEC') or die; + +use Joomla\CMS\Extension\PluginInterface; +use Joomla\CMS\Factory; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; +use Joomla\Event\DispatcherInterface; +use Joomla\Plugin\Task\DemoTasks\Extension\DemoTasks; + +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->set( + PluginInterface::class, + function (Container $container) + { + $dispatcher = $container->get(DispatcherInterface::class); + + $plugin = new DemoTasks( + $dispatcher, + (array) PluginHelper::getPlugin('task', 'demotasks') + ); + $plugin->setApplication(Factory::getApplication()); + + return $plugin; + } + ); + } +}; diff --git a/plugins/task/demotasks/demotasks.php b/plugins/task/demotasks/src/Extension/DemoTasks.php similarity index 97% rename from plugins/task/demotasks/demotasks.php rename to plugins/task/demotasks/src/Extension/DemoTasks.php index 3275578d07d3c..5165c860e103a 100644 --- a/plugins/task/demotasks/demotasks.php +++ b/plugins/task/demotasks/src/Extension/DemoTasks.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Plugin\Task\DemoTasks\Extension; + // Restrict direct access defined('_JEXEC') or die; @@ -23,7 +25,7 @@ * * @since 4.1.0 */ -class PlgTaskDemotasks extends CMSPlugin implements SubscriberInterface +final class DemoTasks extends CMSPlugin implements SubscriberInterface { use TaskPluginTrait;