[2.x] Tags: one way for extensions to tell primary from secondary tags
Maintainers usually reply within 1 day
@Saksham-chourasia is already working on this.
Since Nov 13, 2026.
- #5504 by @Saksham-chourasia — open
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the backend and frontend Tag models, then trace the position checks named in the tags extension: GlobalPolicy, DiscussionResourceFields, Content\Tags, the admin and forum Tags pages, addTagList, addTagComposer, TagSelectionModal, and sortTags. Compare their existing checks with is_primary and the stated counting rules; the issue lists the required helpers, query scopes, compatibility behavior, and documentation updates. Done when these checks use the helpers, secondary tag positions remain null in 2.x, and the deprecation is documented.
Written by the indexing model from the issue text.
Description
Extensions, and the tags extension itself, decide whether a tag is primary by checking position: a secondary tag has none. That ties the tag's kind to its order, which stops secondary tags from ever being ordered (#5236), and the check is repeated in about ten places, with small differences.
Tags already store the kind in is_primary, exposed as isPrimary in the API and Tag.isPrimary() in JS. A child of a primary tag is a primary tag: is_primary is true for it, as it is for its parent.
Proposal
On the backend Tag model and the frontend Tag model:
isPrimary(): a primary tag or a child of one, read fromis_primary.isChild(): a child of a primary tag.isPrimaryParent(): a primary tag without a parent (frontend already has it).isSecondary():!isPrimary().- Backend query scopes
Tag::query()->primary()and->secondary().
Then:
- Move every check in the tags extension from
positionto these:GlobalPolicy,DiscussionResourceFields,Content\Tags, the admin and forum Tags pages,addTagList,addTagComposer,TagSelectionModalandsortTags. - Keep
positionnull for secondary tags in 2.x, so extensions that check it keep working, and mark that check deprecated in the changelog and the extension docs. - The required tag counts keep their behaviour: top-level primary tags count as primary, every other tag (children included) towards the secondary limits. Name it that way in code and docs rather than calling children secondary.
This depends on repairing is_primary: the admin edit modal currently clears it when saving an existing tag. That repair is included in the work on #5236.
The permission mismatch and child-tag counting discussion already have #4065 and #3640; this proposal supplies consistent helpers without deciding a new counting policy.
- Dominant language
- PHP
- Stars
- 6.8k
- Forks
- 891
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 209
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flarum/framework
-
type/accessibility type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Default language is ignored for anyone who chose a language, when the language selector is hiddenPossibly taken @1AbdullahButt claimed this 15 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
[2.x] False CLI/Web PHP mismatch when /usr/bin/php differs from the site's FPMPossibly taken @lazerg claimed this 15 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[2.x] A filter on a resource without a searcher returns a 500Possibly taken @imorland claimed this today. Opentype/bug
flarum/framework#5578 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in flarum/framework
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 87/100
Sylius/Sylius#19359 · 1 comment ·
Maintainers usually reply within 1 day
-
Add php 8.6Open
Difficulty 1/5 Under an hour Newbie friendliness 66/100
mailersend/mailersend-php#199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Configuration new tool
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
novalo-dev/Prestashop-MCP-Server#366 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 10 days