diff --git a/plugins/editors/none/none.xml b/plugins/editors/none/none.xml index 60b7538f7b92b..b653d5653802f 100644 --- a/plugins/editors/none/none.xml +++ b/plugins/editors/none/none.xml @@ -9,8 +9,10 @@ (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt PLG_NONE_XML_DESCRIPTION + Joomla\Plugin\Editors\None - none.php + services + src language/en-GB/plg_editors_none.ini diff --git a/plugins/editors/none/services/provider.php b/plugins/editors/none/services/provider.php new file mode 100644 index 0000000000000..622614394f2ce --- /dev/null +++ b/plugins/editors/none/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\Editors\None\Extension\None; + +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 None( + $dispatcher, + (array) PluginHelper::getPlugin('editors', 'none') + ); + $plugin->setApplication(Factory::getApplication()); + + return $plugin; + } + ); + } +}; diff --git a/plugins/editors/none/none.php b/plugins/editors/none/src/Extension/None.php similarity index 91% rename from plugins/editors/none/none.php rename to plugins/editors/none/src/Extension/None.php index d34bb042ae5ad..cae3b00ced498 100644 --- a/plugins/editors/none/none.php +++ b/plugins/editors/none/src/Extension/None.php @@ -6,11 +6,10 @@ * * @copyright (C) 2006 Open Source Matters, Inc. * @license GNU General Public License version 2 or later; see LICENSE.txt - - * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ -use Joomla\CMS\Factory; +namespace Joomla\Plugin\Editors\None\Extension; + use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Event\Event; @@ -24,7 +23,7 @@ * * @since 1.5 */ -class PlgEditorNone extends CMSPlugin +final class None extends CMSPlugin { /** * Display the editor area. @@ -71,7 +70,7 @@ public function onDisplay( $readonly = !empty($params['readonly']) ? ' readonly disabled' : ''; - Factory::getDocument()->getWebAssetManager() + $this->getApplication()->getDocument()->getWebAssetManager() ->registerAndUseScript( 'webcomponent.editor-none', 'plg_editors_none/joomla-editor-none.min.js', @@ -83,7 +82,7 @@ public function onDisplay( . '' . '' - . $this->_displayButtons($id, $buttons, $asset, $author); + . $this->displayButtons($id, $buttons, $asset, $author); } /** @@ -96,7 +95,7 @@ public function onDisplay( * * @return void|string HTML */ - public function _displayButtons($name, $buttons, $asset, $author) + private function displayButtons($name, $buttons, $asset, $author) { if (is_array($buttons) || (is_bool($buttons) && $buttons)) { $buttonsEvent = new Event(