- md5
- 37f8ffbbf85db33446ebcd2e147c7012
- sha1
- 54c3d7705e323f8ff4c04940aadd0d4cd7d8f2af
- sha256
- 50af2681f0ce1abf1e009551513b94ff01c8821198e52ee7e39ff45b2b45edbb
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors.none
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\Event;
/**
* Plain Textarea Editor Plugin
*
* @since 1.5
*/
class PlgEditorNone extends CMSPlugin
{
/**
* Display the editor area.
*
* @param string $name The control name.
* @param string $content The contents of the text area.
* @param string $width The width of the text area (px or %).
* @param string $height The height of the text area (px or %).
* @param integer $col The number of columns for the textarea.
* @param integer $row The number of rows for the textarea.
* @param boolean $buttons True and the editor buttons will be displayed.
* @param string $id An optional ID for the textarea (note: since 1.6). If not supplied the name is used.
* @param string $asset The object asset
* @param object $author The author.
* @param array $params Associative array of editor parameters.
*
* @return string
*/
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true,
$id = null, $asset = null, $author = null, $params = array())
{
if (empty($id))
{
$id = $name;
}
// Only add "px" to width and height if they are not given as a percentage
if (is_numeric($width))
{
$width .= 'px';
}
if (is_numeric($height))
{
$height .= 'px';
}
$readonly = !empty($params['readonly']) ? ' readonly disabled' : '';
HTMLHelper::_('webcomponent', 'plg_editors_none/joomla-editor-none.min.js', ['version' => 'auto', 'relative' => true]);
return '<joomla-editor-none>'
. '<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);
}
/**
* Displays the editor buttons.
*
* @param string $name The control name.
* @param mixed $buttons [array with button objects | boolean true to display buttons]
* @param string $asset The object asset
* @param object $author The author.
*
* @return void|string HTML
*/
public function _displayButtons($name, $buttons, $asset, $author)
{
$return = '';
if (is_array($buttons) || (is_bool($buttons) && $buttons))
{
$buttonsEvent = new Event(
'getButtons',
[
'editor' => $name,
'buttons' => $buttons,
]
);
$buttonsResult = $this->getDispatcher()->dispatch('getButtons', $buttonsEvent);
$buttons = $buttonsResult['result'];
return LayoutHelper::render('joomla.editors.buttons', $buttons);
}
}
}
The same content is in 6 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha12. See them all, or every version of this file.