User tests: Successful: Unsuccessful:
Pull Request for Issue #46655 .
This adds support for an 'exclude' attribute in the category form field type, allowing developers to exclude specific category IDs from the list.
Usage:
This is useful for excluding categories like 'Uncategorized' from selection lists.
Pull Request for Issue # .
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Title |
|
||||||
I am new to this process. Am I supposed to offer documentation changes or anything else?
I am new to this process. Am I supposed to offer documentation changes or anything else?
@neo314 No, as you only opened the issue you are not required to do anything. It's on the author of this pull request here to do that, if necessary. But it would be nice of course if you could test this PR.
I tested the code I offered. Not sure what further I should do since there are no testing instructions. Not sure if what I offered got changed.
Well this PR is indeed missing testing instructions. If they have been added you could follow these instructions, and if the test was successful submit your test result in the issue tracker. But as said, right now it is missing instructions.
Thanks for the guidance.
@pashaarshad Please create test instructions for the testers.
@pashaarshad It's more logical to add support for filter.excluded filter in Joomla\CMS\HTML\Helpers\Category::options(), similar like we already have for e.g. state of Joomla\Component\Users\Administrator\Model\UsersModel.
Field will just pass attribute value to helper via $filters['filter.excluded']
It's a more solid approach.
I have tested this item ✅ successfully on 03a95fa
I tested this issue, and it was tested successfully.
I have tested this item ✅ successfully on 03a95fa
I tested this issue, and it was tested successfully.
I have tested this item ✅ successfully on 03a95fa
I tested this issue, and it was tested successfully.
Comment for PR #46668:
Hi everyone,
Sorry for the delayed response! I was out of station and had limited access to my development environment. I'm back now and have prepared the testing instructions as requested.
Summary of Changes
This PR adds support for an exclude attribute in the Category form field type (Joomla\CMS\Form\Field\CategoryField). This allows developers to exclude specific category IDs from the dropdown list.
Usage Example:
This is particularly useful for excluding categories like "Uncategorized" or system-reserved categories from user selection.
Testing Instructions
Prerequisites
A fresh Joomla installation with sample data, or create at least 3-4 categories in Content → Categories
Note down the IDs of the categories you want to test with (visible in the ID column of the category list)
Test Steps
Test 1: Basic Exclude Functionality
Go to article.xml
Find the catid field and add the exclude attribute with one or more category IDs:
<field
name="catid"
type="category"
extension="com_content"
exclude="2,4"
...
/>
Go to Content → Articles → New
Click on the Category dropdown
Expected Result: Categories with IDs 2 and 4 should NOT appear in the list
Test 2: Single Category Exclusion
Modify the field to exclude only one category: exclude="1"
Refresh the article form
Expected Result: Only the category with ID 1 is excluded
Test 3: No Exclude Attribute (Backward Compatibility)
Remove the exclude attribute entirely
Refresh the article form
Expected Result: All categories appear as normal (no regression)
Test 4: Empty Exclude Attribute
Set exclude=""
Refresh the article form
Expected Result: All categories appear (same as no attribute)
Test 5: Invalid Category IDs
Set exclude="99999" (non-existent ID)
Refresh the article form
Expected Result: No errors, all existing categories appear
Actual Result BEFORE Applying This Pull Request
The Category form field does not support excluding specific categories
Developers cannot filter out unwanted categories from selection dropdowns
Expected Result AFTER Applying This Pull Request
The exclude attribute is available for the Category form field
Specified category IDs are excluded from the dropdown options
Backward compatibility is maintained when the attribute is not used
Documentation
Documentation link for docs.joomla.org: Documentation update needed - The Category Form Field documentation should include the new exclude attribute
No documentation changes for manual.joomla.org needed
Thank you @richard67, @tecpromotion, and @Denitz for your patience and feedback!
@Denitz - Regarding your suggestion about filter.excluded in the Helper, that's a good point for a more architectural approach. However, this implementation keeps things simple and consistent with how other attributes work in form fields. Happy to discuss further if needed.
Should I push this comment to the PR? Also, do you want me to check if there's any actual code in the PR that needs to be reviewed for the implementation?
@pashaarshad You should follow suggestion from @Denitz
That would be better approach
Thanks @joomdonation and @Denitz for the suggestion!
I've updated the implementation:
Added filter.exclude support in Category::options() method following the same pattern as other filters
Updated CategoryField::getOptions() to pass exclude attribute via $filters['filter.exclude']
Please review!
No new code here.
| Labels |
Added:
Feature
Test instructions missing
PR-6.1-dev
|
||
Looks great now!
@pashaarshad Please provide testing instructions in the description of your PR. The head lines in our pull request template are not there for no reason.