From 60eaafa14fd250d974bd6321369cedc89e9b89fc Mon Sep 17 00:00:00 2001 From: alikon Date: Mon, 27 Jan 2025 21:16:29 +0100 Subject: [PATCH 1/8] max.results --- .../src/Plugin/FieldsListPlugin.php | 6 ++++ administrator/language/en-GB/lib_joomla.ini | 2 ++ plugins/fields/list/list.xml | 33 +++++++++++++++++++ plugins/fields/list/params/list.xml | 31 +++++++++++++++++ plugins/fields/sql/params/sql.xml | 31 +++++++++++++++++ plugins/fields/sql/sql.xml | 33 ++++++++++++++++++- 6 files changed, 135 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_fields/src/Plugin/FieldsListPlugin.php b/administrator/components/com_fields/src/Plugin/FieldsListPlugin.php index d8c59f78322b8..3d076d6d0d57e 100644 --- a/administrator/components/com_fields/src/Plugin/FieldsListPlugin.php +++ b/administrator/components/com_fields/src/Plugin/FieldsListPlugin.php @@ -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; } diff --git a/administrator/language/en-GB/lib_joomla.ini b/administrator/language/en-GB/lib_joomla.ini index f921fdf193c4c..72031ebea3921 100644 --- a/administrator/language/en-GB/lib_joomla.ini +++ b/administrator/language/en-GB/lib_joomla.ini @@ -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" diff --git a/plugins/fields/list/list.xml b/plugins/fields/list/list.xml index 9220b5a1a5e7b..97b889f9e5690 100644 --- a/plugins/fields/list/list.xml +++ b/plugins/fields/list/list.xml @@ -54,6 +54,39 @@ + + + + + + + + + + + + + + + + + JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT + + + + + + + + + + + + + + + diff --git a/plugins/fields/sql/params/sql.xml b/plugins/fields/sql/params/sql.xml index bd7a18081e6c7..d5478d3893cc7 100644 --- a/plugins/fields/sql/params/sql.xml +++ b/plugins/fields/sql/params/sql.xml @@ -44,6 +44,37 @@ + + + + + + + + + + + + + + + diff --git a/plugins/fields/sql/sql.xml b/plugins/fields/sql/sql.xml index bc00290073453..54acde8b03885 100644 --- a/plugins/fields/sql/sql.xml +++ b/plugins/fields/sql/sql.xml @@ -63,7 +63,38 @@ - + + + + + + + + + + + + + + + + From c42b8c8dc2bc3b626fc493b804130377a94bd60b Mon Sep 17 00:00:00 2001 From: alikon Date: Tue, 4 Feb 2025 12:11:09 +0100 Subject: [PATCH 2/8] issues:42376+38835 --- .../sql/updates/mysql/5.3.0-2025-02-05.sql | 2 + .../updates/postgresql/5.3.0-2025-02-05.sql | 2 + .../joomla/form/field/categoryedit.php | 1 + installation/sql/mysql/base.sql | 17 ++-- installation/sql/postgresql/base.sql | 17 ++-- libraries/src/Extension/ExtensionHelper.php | 1 + plugins/system/fancylist/fancylist.xml | 56 +++++++++++ .../system/fancylist/services/provider.php | 46 +++++++++ .../fancylist/src/Extension/FancyList.php | 98 +++++++++++++++++++ 9 files changed, 224 insertions(+), 16 deletions(-) create mode 100644 administrator/components/com_admin/sql/updates/mysql/5.3.0-2025-02-05.sql create mode 100644 administrator/components/com_admin/sql/updates/postgresql/5.3.0-2025-02-05.sql create mode 100644 plugins/system/fancylist/fancylist.xml create mode 100644 plugins/system/fancylist/services/provider.php create mode 100644 plugins/system/fancylist/src/Extension/FancyList.php diff --git a/administrator/components/com_admin/sql/updates/mysql/5.3.0-2025-02-05.sql b/administrator/components/com_admin/sql/updates/mysql/5.3.0-2025-02-05.sql new file mode 100644 index 0000000000000..3c2f8e3520ff9 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/5.3.0-2025-02-05.sql @@ -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); \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.3.0-2025-02-05.sql b/administrator/components/com_admin/sql/updates/postgresql/5.3.0-2025-02-05.sql new file mode 100644 index 0000000000000..fb44e6be72414 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/5.3.0-2025-02-05.sql @@ -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); \ No newline at end of file diff --git a/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php b/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php index 7e2fd4ea0fab5..dc890103e1867 100644 --- a/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php +++ b/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php @@ -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) { diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 534493dbc12f2..5680ebc70855b 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -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), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 663718b278dfb..79ac7f7352575 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -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), diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index f17b506296849..32f05754ce954 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -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], diff --git a/plugins/system/fancylist/fancylist.xml b/plugins/system/fancylist/fancylist.xml new file mode 100644 index 0000000000000..901180bcc1862 --- /dev/null +++ b/plugins/system/fancylist/fancylist.xml @@ -0,0 +1,56 @@ + + + plg_system_fancylist + Joomla! Project + 2025-02 + (C) 2025 Open Source Matters, Inc. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 5.3 + PLG_SYSTEM_FANCYLIST_XML_DESCRIPTION + Joomla\Plugin\System\FancyList + + services + src + + + language/en-GB/plg_system_fancylist.ini + language/en-GB/plg_system_fancylist.sys.ini + + + +
+ + + + + + + /> + + + + + + + + /> +
+
+
+
diff --git a/plugins/system/fancylist/services/provider.php b/plugins/system/fancylist/services/provider.php new file mode 100644 index 0000000000000..c3a9366212236 --- /dev/null +++ b/plugins/system/fancylist/services/provider.php @@ -0,0 +1,46 @@ + + * @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; + } + ); + } +}; diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php new file mode 100644 index 0000000000000..bc3571d7924ad --- /dev/null +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -0,0 +1,98 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace Joomla\Plugin\System\FancyList\Extension; + +use Joomla\CMS\Event\Model\PrepareFormEvent; +use Joomla\CMS\Plugin\CMSPlugin; +use Joomla\Event\SubscriberInterface; + +// phpcs:disable PSR1.Files.SideEffects +\defined('_JEXEC') or die; +// phpcs:enable PSR1.Files.SideEffects + +/** + * Allows to set default values for 'data-max-results' and 'data-max-render' attributes + * in the fancylist form fields. + * + * @since __DEPLOY_VERSION__ + */ +final class FancyList extends CMSPlugin implements SubscriberInterface +{ + /** + * Returns the list of event subscribers. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getSubscribedEvents(): array + { + return [ + 'onContentPrepareForm' => 'onContentPrepareForm', + ]; + } + + /** + * Handles the onContentPrepareForm event to dynamically set default values for + * 'data-max-results' and 'data-max-render' attributes in the form fields. + * + * Modifies forms with the names 'com_content.article' and 'com_content.articles.filter'. + * For the 'com_content.articles.filter' form, it adds attributes to the 'category_id' field. + * For 'com_content.article', it checks for the 'catid' field and sets the attributes if present. + * + * @param PrepareFormEvent $event The event containing the form to be modified. + * + * @return bool True if the form processing should continue, false otherwise. + * + * @since __DEPLOY_VERSION__ + */ + + public function onContentPrepareForm(PrepareFormEvent $event): bool + { + $form = $event->getForm(); + if (!\in_array($form->getName(), ['com_content.article', 'com_content.articles.filter'])) { + return true; + } + + // Fetch the configuration setting + $maxResults = (string) $this->params->get('max_results', '10'); + $maxRender = (string) $this->params->get('max_render', '-1'); + + if ($form->getName() === 'com_content.articles.filter') { + + // Get the field from the SimpleXMLElement structure + $xml = $form->getXml(); + + if (!$xml instanceof \SimpleXMLElement) { + return true; + } + + // Get the category_id field + $field = $xml->xpath("//field[@name='category_id']")[0] ?? null; + + if ($field) { + $field->addAttribute('data-max-results', $maxResults); + $field->addAttribute('data-max-render', $maxRender); + } + + return true; + } + + // Check if the field exists in the form + if ($form->getField('catid')) { + // Inject the value into the form field's attributes + $form->setFieldAttribute('catid', 'data-max-results', $maxResults); + $form->setFieldAttribute('catid', 'data-max-render', $maxRender); + } + + return true; + } +} From 6082468a873a2f96fd9daa52bd93ccda1b3124ae Mon Sep 17 00:00:00 2001 From: alikon Date: Tue, 4 Feb 2025 13:52:43 +0100 Subject: [PATCH 3/8] cs --- plugins/system/fancylist/src/Extension/FancyList.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php index bc3571d7924ad..72511253583c7 100644 --- a/plugins/system/fancylist/src/Extension/FancyList.php +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -65,7 +65,6 @@ public function onContentPrepareForm(PrepareFormEvent $event): bool // Fetch the configuration setting $maxResults = (string) $this->params->get('max_results', '10'); $maxRender = (string) $this->params->get('max_render', '-1'); - if ($form->getName() === 'com_content.articles.filter') { // Get the field from the SimpleXMLElement structure From 9bd98ffc1161e94404e96cd61ac3de086e558213 Mon Sep 17 00:00:00 2001 From: alikon Date: Tue, 4 Feb 2025 16:48:52 +0100 Subject: [PATCH 4/8] cs2 --- plugins/system/fancylist/src/Extension/FancyList.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php index 72511253583c7..6ea2c3bbd4b45 100644 --- a/plugins/system/fancylist/src/Extension/FancyList.php +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -66,7 +66,6 @@ public function onContentPrepareForm(PrepareFormEvent $event): bool $maxResults = (string) $this->params->get('max_results', '10'); $maxRender = (string) $this->params->get('max_render', '-1'); if ($form->getName() === 'com_content.articles.filter') { - // Get the field from the SimpleXMLElement structure $xml = $form->getXml(); From 0c9f3b5d56dba7936460e0a13ea5135226e67970 Mon Sep 17 00:00:00 2001 From: alikon Date: Tue, 4 Feb 2025 17:48:09 +0100 Subject: [PATCH 5/8] follow#44817 --- plugins/system/fancylist/src/Extension/FancyList.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php index 6ea2c3bbd4b45..f1a957565d25c 100644 --- a/plugins/system/fancylist/src/Extension/FancyList.php +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -55,11 +55,11 @@ public static function getSubscribedEvents(): array * @since __DEPLOY_VERSION__ */ - public function onContentPrepareForm(PrepareFormEvent $event): bool + public function onContentPrepareForm(PrepareFormEvent $event): void { $form = $event->getForm(); if (!\in_array($form->getName(), ['com_content.article', 'com_content.articles.filter'])) { - return true; + return; } // Fetch the configuration setting @@ -70,7 +70,7 @@ public function onContentPrepareForm(PrepareFormEvent $event): bool $xml = $form->getXml(); if (!$xml instanceof \SimpleXMLElement) { - return true; + return; } // Get the category_id field @@ -81,7 +81,7 @@ public function onContentPrepareForm(PrepareFormEvent $event): bool $field->addAttribute('data-max-render', $maxRender); } - return true; + return; } // Check if the field exists in the form @@ -91,6 +91,6 @@ public function onContentPrepareForm(PrepareFormEvent $event): bool $form->setFieldAttribute('catid', 'data-max-render', $maxRender); } - return true; + return; } } From 4efb5b5746d8357332c79e793f1e9e8a5390903e Mon Sep 17 00:00:00 2001 From: alikon Date: Mon, 10 Feb 2025 10:19:40 +0100 Subject: [PATCH 6/8] lang --- administrator/language/en-GB/plg_system_fancylist.ini | 7 +++++++ administrator/language/en-GB/plg_system_fancylist.sys.ini | 8 ++++++++ plugins/system/fancylist/fancylist.xml | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 administrator/language/en-GB/plg_system_fancylist.ini create mode 100644 administrator/language/en-GB/plg_system_fancylist.sys.ini diff --git a/administrator/language/en-GB/plg_system_fancylist.ini b/administrator/language/en-GB/plg_system_fancylist.ini new file mode 100644 index 0000000000000..ecb55d3c0cd50 --- /dev/null +++ b/administrator/language/en-GB/plg_system_fancylist.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; (C) 2025 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + +PLG_SYSTEM_FANCYLIST="System - Fancy List" +PLG_SYSTEM_FANCYLIST_XML_DESCRIPTION="This plugin allows you to set Fancy List maximum results and maximum rendered items." \ No newline at end of file diff --git a/administrator/language/en-GB/plg_system_fancylist.sys.ini b/administrator/language/en-GB/plg_system_fancylist.sys.ini new file mode 100644 index 0000000000000..9c7f9a0f1f7a6 --- /dev/null +++ b/administrator/language/en-GB/plg_system_fancylist.sys.ini @@ -0,0 +1,8 @@ +; Joomla! Project +; (C) 2025 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + +PLG_SYSTEM_FANCYLIST="System - Fancy List" +PLG_SYSTEM_FANCYLIST_XML_DESCRIPTION="This plugin allows you to set Fancy List maximum results and maximum rendered items." + diff --git a/plugins/system/fancylist/fancylist.xml b/plugins/system/fancylist/fancylist.xml index 901180bcc1862..12c836443cfc3 100644 --- a/plugins/system/fancylist/fancylist.xml +++ b/plugins/system/fancylist/fancylist.xml @@ -34,7 +34,7 @@ - /> + J50 - /> + From 06ae85a22bf737993b4e19dfa823e0086819f929 Mon Sep 17 00:00:00 2001 From: alikon Date: Mon, 10 Feb 2025 20:39:49 +0100 Subject: [PATCH 7/8] spacing --- plugins/system/fancylist/fancylist.xml | 38 +++++++++---------- .../fancylist/src/Extension/FancyList.php | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/system/fancylist/fancylist.xml b/plugins/system/fancylist/fancylist.xml index 12c836443cfc3..63fb3bb8b882d 100644 --- a/plugins/system/fancylist/fancylist.xml +++ b/plugins/system/fancylist/fancylist.xml @@ -9,21 +9,21 @@ www.joomla.org 5.3 PLG_SYSTEM_FANCYLIST_XML_DESCRIPTION - Joomla\Plugin\System\FancyList - - services + Joomla\Plugin\System\FancyList + + services src - - + + language/en-GB/plg_system_fancylist.ini language/en-GB/plg_system_fancylist.sys.ini - - -
- + +
+ J25 - - + J50 - -
-
- +
+
+
+
diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php index f1a957565d25c..f7955891bc4d0 100644 --- a/plugins/system/fancylist/src/Extension/FancyList.php +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -50,7 +50,7 @@ public static function getSubscribedEvents(): array * * @param PrepareFormEvent $event The event containing the form to be modified. * - * @return bool True if the form processing should continue, false otherwise. + * @return void * * @since __DEPLOY_VERSION__ */ From 108eeabc57f95dccd8e07db5c48242dde112d017 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Tue, 11 Feb 2025 11:49:19 +0100 Subject: [PATCH 8/8] add category filter --- plugins/system/fancylist/src/Extension/FancyList.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/system/fancylist/src/Extension/FancyList.php b/plugins/system/fancylist/src/Extension/FancyList.php index f7955891bc4d0..85e8b0ccc70ad 100644 --- a/plugins/system/fancylist/src/Extension/FancyList.php +++ b/plugins/system/fancylist/src/Extension/FancyList.php @@ -57,15 +57,22 @@ public static function getSubscribedEvents(): array public function onContentPrepareForm(PrepareFormEvent $event): void { + $context = [ + 'com_content.article', + 'com_content.articles.filter', + 'com_categories.categories.content.filter', + ]; + $form = $event->getForm(); - if (!\in_array($form->getName(), ['com_content.article', 'com_content.articles.filter'])) { + if (!\in_array($form->getName(), $context)) { return; } // Fetch the configuration setting $maxResults = (string) $this->params->get('max_results', '10'); $maxRender = (string) $this->params->get('max_render', '-1'); - if ($form->getName() === 'com_content.articles.filter') { + if ($form->getName() === 'com_content.articles.filter' || + $form->getName() === 'com_categories.categories.content.filter') { // Get the field from the SimpleXMLElement structure $xml = $form->getXml();