first commit
This commit is contained in:
31
plugins/fields/text/params/text.xml
Normal file
31
plugins/fields/text/params/text.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<fields name="fieldparams">
|
||||
<fieldset name="fieldparams">
|
||||
<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>
|
||||
<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
|
||||
<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
|
||||
<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
|
||||
<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="maxlength"
|
||||
type="number"
|
||||
label="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_LABEL"
|
||||
filter="integer"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</form>
|
||||
46
plugins/fields/text/services/provider.php
Normal file
46
plugins/fields/text/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.text
|
||||
*
|
||||
* @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\Text\Extension\Text;
|
||||
|
||||
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 Text(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('fields', 'text')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
27
plugins/fields/text/src/Extension/Text.php
Normal file
27
plugins/fields/text/src/Extension/Text.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.text
|
||||
*
|
||||
* @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\Text\Extension;
|
||||
|
||||
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 Text Plugin
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
final class Text extends FieldsPlugin implements SubscriberInterface
|
||||
{
|
||||
}
|
||||
53
plugins/fields/text/text.xml
Normal file
53
plugins/fields/text/text.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="fields" method="upgrade">
|
||||
<name>plg_fields_text</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_TEXT_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\Fields\Text</namespace>
|
||||
<files>
|
||||
<folder>params</folder>
|
||||
<folder plugin="text">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_fields_text.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_fields_text.sys.ini</language>
|
||||
</languages>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="filter"
|
||||
type="list"
|
||||
label="PLG_FIELDS_TEXT_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>
|
||||
<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
|
||||
<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
|
||||
<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
|
||||
<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="maxlength"
|
||||
type="number"
|
||||
label="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_LABEL"
|
||||
filter="integer"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
23
plugins/fields/text/tmpl/text.php
Normal file
23
plugins/fields/text/tmpl/text.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Fields.Text
|
||||
*
|
||||
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$value = $field->value;
|
||||
|
||||
if ($value == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
$value = implode(', ', $value);
|
||||
}
|
||||
|
||||
echo htmlentities($value);
|
||||
Reference in New Issue
Block a user