first commit
This commit is contained in:
77
plugins/fields/editor/editor.xml
Normal file
77
plugins/fields/editor/editor.xml
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="fields" method="upgrade">
|
||||
<name>plg_fields_editor</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2016-03</creationDate>
|
||||
<copyright>(C) 2016 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.7.0</version>
|
||||
<description>PLG_FIELDS_EDITOR_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Fields\Editor</namespace>
|
||||
<files>
|
||||
<folder>params</folder>
|
||||
<folder plugin="editor">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_fields_editor.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_fields_editor.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="buttons"
|
||||
type="radio"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="hide"
|
||||
type="plugins"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_BUTTONS_HIDE_LABEL"
|
||||
folder="editors-xtd"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="width"
|
||||
type="text"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_WIDTH_LABEL"
|
||||
default="100%"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="height"
|
||||
type="text"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_LABEL"
|
||||
default="250px"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter"
|
||||
type="list"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_FILTER_LABEL"
|
||||
class="list"
|
||||
default="\Joomla\CMS\Component\ComponentHelper::filterText"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
|
||||
<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
|
||||
<option value="\Joomla\CMS\Component\ComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
53
plugins/fields/editor/params/editor.xml
Normal file
53
plugins/fields/editor/params/editor.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<field
|
||||
name="buttons"
|
||||
type="list"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_LABEL"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="hide"
|
||||
type="plugins"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_BUTTONS_HIDE_LABEL"
|
||||
folder="editors-xtd"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="width"
|
||||
type="text"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_WIDTH_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="height"
|
||||
type="text"
|
||||
label="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter"
|
||||
type="list"
|
||||
label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
|
||||
class="list"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
|
||||
<option value="0">JNO</option>
|
||||
<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
|
||||
<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
|
||||
<option value="\Joomla\CMS\Component\ComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
46
plugins/fields/editor/services/provider.php
Normal file
46
plugins/fields/editor/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.editor
|
||||
*
|
||||
* @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\Fields\Editor\Extension\Editor;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new Editor(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('fields', 'editor')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
52
plugins/fields/editor/src/Extension/Editor.php
Normal file
52
plugins/fields/editor/src/Extension/Editor.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.editor
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\Fields\Editor\Extension;
|
||||
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Fields Editor Plugin
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class Editor extends FieldsPlugin implements SubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
|
||||
*
|
||||
* @param stdClass $field The field.
|
||||
* @param \DOMElement $parent The field node parent.
|
||||
* @param Form $form The form.
|
||||
*
|
||||
* @return \DOMElement
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form)
|
||||
{
|
||||
$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);
|
||||
|
||||
if (!$fieldNode) {
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
$fieldNode->setAttribute('buttons', $field->fieldparams->get('buttons', $this->params->get('buttons', 0)) ? 'true' : 'false');
|
||||
$fieldNode->setAttribute('hide', implode(',', $field->fieldparams->get('hide', [])));
|
||||
|
||||
return $fieldNode;
|
||||
}
|
||||
}
|
||||
21
plugins/fields/editor/tmpl/editor.php
Normal file
21
plugins/fields/editor/tmpl/editor.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.Editor
|
||||
*
|
||||
* @copyright (C) 2017 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\HTML\HTMLHelper;
|
||||
|
||||
$value = $field->value;
|
||||
|
||||
if ($value == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
echo HTMLHelper::_('content.prepare', $value);
|
||||
Reference in New Issue
Block a user