first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="fields" method="upgrade">
<name>plg_fields_list</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_LIST_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Fields\ListField</namespace>
<files>
<folder>params</folder>
<folder plugin="list">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_fields_list.ini</language>
<language tag="en-GB">language/en-GB/plg_fields_list.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="multiple"
type="radio"
label="PLG_FIELDS_LIST_PARAMS_MULTIPLE_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="options"
type="subform"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
icon="list"
multiple="true"
>
<form hidden="true" name="list_templates_modal" repeat="true">
<field
name="name"
type="text"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_NAME_LABEL"
/>
<field
name="value"
type="text"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_VALUE_LABEL"
/>
</form>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fields name="fieldparams">
<fieldset name="fieldparams">
<field
name="multiple"
type="list"
label="PLG_FIELDS_LIST_PARAMS_MULTIPLE_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="options"
type="subform"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
icon="list"
multiple="true"
>
<form hidden="true" name="list_templates_modal" repeat="true">
<field
name="name"
type="text"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_NAME_LABEL"
required="true"
/>
<field
name="value"
type="text"
label="PLG_FIELDS_LIST_PARAMS_OPTIONS_VALUE_LABEL"
/>
</form>
</field>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic">
<fieldset name="formoptions">
<field
name="form_layout"
type="list"
label="COM_FIELDS_FIELD_FORM_LAYOUT_LABEL"
class="form-select"
>
<option value="joomla.form.field.list">JDEFAULT</option>
<option value="joomla.form.field.list-fancy-select">PLG_FIELDS_LIST_PARAMS_FORM_LAYOUT_FANCY_SELECT</option>
</field>
</fieldset>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.list
*
* @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\ListField\Extension\ListPlugin;
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 ListPlugin(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('fields', 'list')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,82 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.list
*
* @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\ListField\Extension;
use Joomla\Component\Fields\Administrator\Plugin\FieldsListPlugin;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Fields List Plugin
*
* @since 3.7.0
*/
final class ListPlugin extends FieldsListPlugin
{
/**
* Before prepares the field value.
*
* @param string $context The context.
* @param \stdclass $item The item.
* @param \stdclass $field The field.
*
* @return void
*
* @since 3.7.0
*/
public function onCustomFieldsBeforePrepareField($context, $item, $field)
{
if (!$this->getApplication()->isClient('api')) {
return;
}
if (!$this->isTypeSupported($field->type)) {
return;
}
$options = $this->getOptionsFromField($field);
$field->apivalue = [];
if (\is_array($field->value)) {
foreach ($field->value as $value) {
$field->apivalue[$value] = $options[$value];
}
}
}
/**
* Prepares the field
*
* @param string $context The context.
* @param stdclass $item The item.
* @param stdclass $field The field.
*
* @return object
*
* @since 3.9.2
*/
public function onCustomFieldsPrepareField($context, $item, $field)
{
// Check if the field should be processed
if (!$this->isTypeSupported($field->type)) {
return;
}
// The field's rawvalue should be an array
if (!\is_array($field->rawvalue)) {
$field->rawvalue = (array) $field->rawvalue;
}
return parent::onCustomFieldsPrepareField($context, $item, $field);
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.List
*
* @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\Language\Text;
$fieldValue = $field->value;
if ($fieldValue == '') {
return;
}
$fieldValue = (array) $fieldValue;
$texts = [];
$options = $this->getOptionsFromField($field);
foreach ($options as $value => $name) {
if (in_array((string) $value, $fieldValue)) {
$texts[] = Text::_($name);
}
}
echo htmlentities(implode(', ', $texts));