Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redo of #42765 #44794

Draft
wants to merge 8 commits into
base: 5.3-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_system_fancylist', 'plugin', 'fancylist', 'system', 0, 1, 1, 0, 0, '', '{}', '', 55, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_system_fancylist', 'plugin', 'fancylist', 'system', 0, 1, 1, 0, 0, '', '{}', '', 55, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
$attr .= $multiple ? ' multiple' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';
$attr .= $dataAttribute;

// To avoid user's confusion, readonly="true" should imply disabled="disabled".
if ($readonly || $disabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form
$element->setAttribute('value', $value);
}

// Set data attributes
$dataMaxResult = $field->params->get('data_max_results', 10);
$dataMaxRender = $field->params->get('data_max_render', -1);
$fieldNode->setAttribute('data-max-results', (string) $dataMaxResult);
$fieldNode->setAttribute('data-max-render', (string) $dataMaxRender);

return $fieldNode;
}

Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ JLIB_FORM_FIELD_PARAM_INTEGER_STEP_DESC="Each option will be the previous option
JLIB_FORM_FIELD_PARAM_INTEGER_STEP_LABEL="Step"
JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT="HTML Select"
JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT="Enhanced Select"
JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER="Max Render"
JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS="Max Results"
JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL="Form Layout"
JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_DESC="Allow multiple values to be selected."
JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple"
Expand Down
17 changes: 9 additions & 8 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,15 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
(0, 'plg_system_debug', 'plugin', 'debug', 'system', 0, 1, 1, 0, 1, '', '{"profile":"1","queries":"1","memory":"1","language_files":"1","language_strings":"1","strip-first":"1","strip-prefix":"","strip-suffix":""}', '', 4, 0),
(0, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, 1, '', '', '', 5, 0),
(0, 'plg_system_highlight', 'plugin', 'highlight', 'system', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_system_httpheaders', 'plugin', 'httpheaders', 'system', 0, 1, 1, 0, 1, '', '{}', '', 7, 0),
(0, 'plg_system_jooa11y', 'plugin', 'jooa11y', 'system', 0, 1, 1, 0, 1, '', '', '', 8, 0),
(0, 'plg_system_languagecode', 'plugin', 'languagecode', 'system', 0, 0, 1, 0, 1, '', '', '', 9, 0),
(0, 'plg_system_languagefilter', 'plugin', 'languagefilter', 'system', 0, 0, 1, 0, 1, '', '', '', 10, 0),
(0, 'plg_system_log', 'plugin', 'log', 'system', 0, 1, 1, 0, 1, '', '', '', 11, 0),
(0, 'plg_system_logout', 'plugin', 'logout', 'system', 0, 1, 1, 0, 1, '', '', '', 12, 0),
(0, 'plg_system_fancylist', 'plugin', 'fancylist', 'system', 0, 1, 1, 0, 1, '', '{}', '', 5, 0),
(0, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_system_highlight', 'plugin', 'highlight', 'system', 0, 1, 1, 0, 1, '', '', '', 7, 0),
(0, 'plg_system_httpheaders', 'plugin', 'httpheaders', 'system', 0, 1, 1, 0, 1, '', '{}', '', 8, 0),
(0, 'plg_system_jooa11y', 'plugin', 'jooa11y', 'system', 0, 1, 1, 0, 1, '', '', '', 9, 0),
(0, 'plg_system_languagecode', 'plugin', 'languagecode', 'system', 0, 0, 1, 0, 1, '', '', '', 10, 0),
(0, 'plg_system_languagefilter', 'plugin', 'languagefilter', 'system', 0, 0, 1, 0, 1, '', '', '', 11, 0),
(0, 'plg_system_log', 'plugin', 'log', 'system', 0, 1, 1, 0, 1, '', '', '', 12, 0),
(0, 'plg_system_logout', 'plugin', 'logout', 'system', 0, 1, 1, 0, 1, '', '', '', 13, 0),
(0, 'plg_system_privacyconsent', 'plugin', 'privacyconsent', 'system', 0, 0, 1, 0, 1, '', '{}', '', 14, 0),
(0, 'plg_system_redirect', 'plugin', 'redirect', 'system', 0, 0, 1, 0, 1, '', '', '', 15, 0),
(0, 'plg_system_remember', 'plugin', 'remember', 'system', 0, 1, 1, 0, 1, '', '', '', 16, 0),
Expand Down
17 changes: 9 additions & 8 deletions installation/sql/postgresql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,15 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_system_actionlogs', 'plugin', 'actionlogs', 'system', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_system_cache', 'plugin', 'cache', 'system', 0, 0, 1, 0, 1, '', '{"browsercache":"0","cachetime":"15"}', '', 3, 0),
(0, 'plg_system_debug', 'plugin', 'debug', 'system', 0, 1, 1, 0, 1, '', '{"profile":"1","queries":"1","memory":"1","language_files":"1","language_strings":"1","strip-first":"1","strip-prefix":"","strip-suffix":""}', '', 4, 0),
(0, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, 1, '', '', '', 5, 0),
(0, 'plg_system_highlight', 'plugin', 'highlight', 'system', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_system_httpheaders', 'plugin', 'httpheaders', 'system', 0, 1, 1, 0, 1, '', '{}', '', 7, 0),
(0, 'plg_system_jooa11y', 'plugin', 'jooa11y', 'system', 0, 1, 1, 0, 1, '', '', '', 8, 0),
(0, 'plg_system_languagecode', 'plugin', 'languagecode', 'system', 0, 0, 1, 0, 1, '', '', '', 9, 0),
(0, 'plg_system_languagefilter', 'plugin', 'languagefilter', 'system', 0, 0, 1, 0, 1, '', '', '', 10, 0),
(0, 'plg_system_log', 'plugin', 'log', 'system', 0, 1, 1, 0, 1, '', '', '', 11, 0),
(0, 'plg_system_logout', 'plugin', 'logout', 'system', 0, 1, 1, 0, 1, '', '', '', 12, 0),
(0, 'plg_system_fancylist', 'plugin', 'fancylist', 'system', 0, 1, 1, 0, 1, '', '{}', '', 5, 0),
(0, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_system_highlight', 'plugin', 'highlight', 'system', 0, 1, 1, 0, 1, '', '', '', 7, 0),
(0, 'plg_system_httpheaders', 'plugin', 'httpheaders', 'system', 0, 1, 1, 0, 1, '', '{}', '', 8, 0),
(0, 'plg_system_jooa11y', 'plugin', 'jooa11y', 'system', 0, 1, 1, 0, 1, '', '', '', 9, 0),
(0, 'plg_system_languagecode', 'plugin', 'languagecode', 'system', 0, 0, 1, 0, 1, '', '', '', 10, 0),
(0, 'plg_system_languagefilter', 'plugin', 'languagefilter', 'system', 0, 0, 1, 0, 1, '', '', '', 11, 0),
(0, 'plg_system_log', 'plugin', 'log', 'system', 0, 1, 1, 0, 1, '', '', '', 12, 0),
(0, 'plg_system_logout', 'plugin', 'logout', 'system', 0, 1, 1, 0, 1, '', '', '', 13, 0),
(0, 'plg_system_privacyconsent', 'plugin', 'privacyconsent', 'system', 0, 0, 1, 0, 1, '', '{}', '', 14, 0),
(0, 'plg_system_redirect', 'plugin', 'redirect', 'system', 0, 0, 1, 0, 1, '', '', '', 15, 0),
(0, 'plg_system_remember', 'plugin', 'remember', 'system', 0, 1, 1, 0, 1, '', '', '', 16, 0),
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class ExtensionHelper
['plugin', 'actionlogs', 'system', 0],
['plugin', 'cache', 'system', 0],
['plugin', 'debug', 'system', 0],
['plugin', 'fancylist', 'system', 0],
['plugin', 'fields', 'system', 0],
['plugin', 'guidedtours', 'system', 0],
['plugin', 'highlight', 'system', 0],
Expand Down
33 changes: 33 additions & 0 deletions plugins/fields/list/list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,39 @@
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>

<field
name="data_max_results"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS"
default="10"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
</field>

<field
name="data_max_render"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER"
default="-1"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="-1">JALL</option>
</field>

<field
name="options"
type="subform"
Expand Down
31 changes: 31 additions & 0 deletions plugins/fields/list/params/list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,37 @@
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>
<field
name="data_max_results"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS"
default="10"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
</field>
<field
name="data_max_render"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER"
default="-1"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="-1">JALL</option>
</field>
</fieldset>
</fieldset>
</fields>
Expand Down
31 changes: 31 additions & 0 deletions plugins/fields/sql/params/sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,37 @@
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>
<field
name="data_max_results"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS"
default="10"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
</field>
<field
name="data_max_render"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER"
default="-1"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="-1">JALL</option>
</field>
</fieldset>
</fieldset>
</fields>
Expand Down
33 changes: 32 additions & 1 deletion plugins/fields/sql/sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,38 @@
<option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option>
<option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option>
</field>

<field
name="data_max_results"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS"
default="10"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
</field>

<field
name="data_max_render"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER"
default="-1"
filter="integer"
validate="options"
showon="form_layout:joomla.form.field.list-fancy-select"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="-1">JALL</option>
</field>
</fieldset>
</fields>
</config>
Expand Down
56 changes: 56 additions & 0 deletions plugins/system/fancylist/fancylist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>plg_system_fancylist</name>
<author>Joomla! Project</author>
<creationDate>2025-02</creationDate>
<copyright>(C) 2025 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>5.3</version>
<description>PLG_SYSTEM_FANCYLIST_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\System\FancyList</namespace>
<files>
<folder plugin="fancylist">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_system_fancylist.ini</language>
<language tag="en-GB">language/en-GB/plg_system_fancylist.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="max_results"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRESULTS"
default="10"
filter="integer"
validate="options"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
/>
<field
name="max_render"
type="list"
label="JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT_MAXRENDER"
default="-1"
filter="integer"
validate="options"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="25">J25</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="-1">JALL</option>
/>
</fieldset>
</fields>
</config>
</extension>
46 changes: 46 additions & 0 deletions plugins/system/fancylist/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage System.fancylist
*
* @copyright (C) 2025 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\System\FancyList\Extension\FancyList;

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): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$fancyListPlugin = new FancyList(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('system', 'fancylist')
);
$fancyListPlugin->setApplication(Factory::getApplication());

return $fancyListPlugin;
}
);
}
};
Loading