Skip to content
4 changes: 3 additions & 1 deletion plugins/editors/none/none.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<description>PLG_NONE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Editors\None</namespace>
<files>
<filename plugin="none">none.php</filename>
<folder plugin="none">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_editors_none.ini</language>
Expand Down
49 changes: 49 additions & 0 deletions plugins/editors/none/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Editors.none
*
* @copyright (C) 2023 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\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;
}
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @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;
Expand All @@ -24,7 +23,7 @@
*
* @since 1.5
*/
class PlgEditorNone extends CMSPlugin
final class None extends CMSPlugin
{
/**
* Display the editor area.
Expand Down Expand Up @@ -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',
Expand All @@ -83,7 +82,7 @@ public function onDisplay(
. '<textarea name="' . $name . '" id="' . $id . '" cols="' . $col . '" rows="' . $row
. '" style="width: ' . $width . '; height: ' . $height . ';"' . $readonly . '>' . $content . '</textarea>'
. '</joomla-editor-none>'
. $this->_displayButtons($id, $buttons, $asset, $author);
. $this->displayButtons($id, $buttons, $asset, $author);
}

/**
Expand All @@ -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(
Expand Down