Feature PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar pashaarshad
pashaarshad
11 Jan 2026

Pull Request for Issue #46655 .

Description

This PR adds support for an exclude attribute to the category form field type, allowing developers to exclude specific category IDs from the dropdown list.

Problem Statement

Developers often need to exclude certain categories (like "Uncategorized") from category selection lists in forms. Previously, there was no built-in way to do this with the standard category field type.

Solution

Added an exclude attribute that accepts a comma-separated list of category IDs to exclude from the options.

Usage Example

<field 
    name="category" 
    type="category" 
    extension="com_content" 
    exclude="1,5,10" 
    label="Select Category" 
/>

Implementation Details

  • Added filtering logic in the getOptions() method of CategoryField class
  • The exclude attribute accepts comma-separated category IDs
  • Category IDs are properly sanitized using intval()
  • Filtering is only applied when the exclude attribute is set and contains valid IDs

Testing

The implementation follows the same pattern as the custom field provided in issue #46655 and has been tested to ensure:

  • Categories specified in the exclude attribute are properly filtered out
  • Empty or invalid exclude values are handled gracefully
  • The field continues to work normally when no exclude attribute is present

Closes #46655

avatar pashaarshad pashaarshad - open - 11 Jan 2026
avatar pashaarshad pashaarshad - change - 11 Jan 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 11 Jan 2026
Category Libraries
avatar richard67
richard67 - comment - 11 Jan 2026

@pashaarshad Please rebase this PR to 6.1-dev. 5.4 and 6.0 do not accept new feautures. See https://github.com/joomla/joomla-cms?tab=readme-ov-file#which-branch-should-my-pull-request-target .

avatar richard67 richard67 - change - 11 Jan 2026
The description was changed
avatar richard67 richard67 - edited - 11 Jan 2026
avatar pashaarshad
pashaarshad - comment - 12 Jan 2026

ok sir

avatar brianteeman
brianteeman - comment - 12 Jan 2026

Please close this

avatar pashaarshad pashaarshad - close - 12 Jan 2026
avatar pashaarshad
pashaarshad - comment - 12 Jan 2026

Whtl

avatar pashaarshad
pashaarshad - comment - 12 Jan 2026

Whtl

avatar pashaarshad pashaarshad - change - 12 Jan 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-01-12 07:55:54
Closed_By pashaarshad
Labels Added: Feature PR-5.4-dev
avatar pashaarshad pashaarshad - change - 12 Jan 2026
Status Closed New
Closed_Date 2026-01-12 07:55:54
Closed_By pashaarshad
avatar pashaarshad pashaarshad - change - 12 Jan 2026
Status New Pending
avatar pashaarshad pashaarshad - reopen - 12 Jan 2026
avatar pashaarshad pashaarshad - change - 12 Jan 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-01-12 07:56:09
Closed_By pashaarshad
avatar pashaarshad pashaarshad - close - 12 Jan 2026
avatar pashaarshad
pashaarshad - comment - 12 Jan 2026

Ok sir

Add a Comment

Login with GitHub to post a comment