Allow standard Text fields to be used as Checkboxes, Radio, or List filters#95
Open
PixedBo wants to merge 2 commits intoJoomline:masterfrom
Open
Allow standard Text fields to be used as Checkboxes, Radio, or List filters#95PixedBo wants to merge 2 commits intoJoomline:masterfrom
PixedBo wants to merge 2 commits intoJoomline:masterfrom
Conversation
Added dynamic option population for text fields in specific layouts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, the module only supports
checkboxes,radio, andlistlayouts for custom fields that natively possess an options array. However, it is very common to have standardtextfields containing a limited, repetitive set of values that would be perfectly suited for multiple-choice filtering.What this PR does
This PR introduces the ability to render and filter standard
textfields as multiple-choice inputs, specifically focusing on thecom_contentcomponent. It automatically generates the options based on the actual data present in the database for articles.Detailed Changes:
Module (
src/Helper/JlcontentfieldsfilterHelper.php):textfields when the selected layout ischeckboxes,radio, orlist.#__fields_valuestable to extractDISTINCTvalues for that specific field.optionsarray so the existing layout files can render them properly.setHiddenOptions()function to hide empty options based on thecom_contentcategory context.System Plugin (
src/Extension/Jlcontentfieldsfilter.php):onAfterRoute()for thecase 'text':block.IN (...)clause.rangearrays (from/to) and standard single-stringLIKEsearches.How to Test / Steps to Reproduce
1. Setup the Custom Field
Text(e.g., named "City" or "Color").Textand Individual layout tocheckboxes2. Create Test Content
3. Configure the Module
MOD_JLCONTENTFIELDSFILTERmodule on a visible position.4. Test the Frontend Rendering
DISTINCT).5. Test the Filtering Logic