Feature PBF PR-6.1-dev Pending

User tests: Successful: Unsuccessful:

avatar hiteshm0
hiteshm0
18 Jan 2026

Pull Request for Issue #46701

Summary of Changes

This PR fixes issue #46701 where archived categories were not selectable in article edit and batch operation dropdowns. And prevents category from resetting to first available non-archived category when editing articles assigned to archived categories.

Testing Instructions

First Test:

  1. Create an article.

  2. Verify that archived categories can be assigned to the article.

  3. Assign a archived category to the article.

  4. Edit the article

  5. Verify that the category of the article has not been auto assigned to the first available non-archived category.

Second Test:

  1. Select 3-4 articles -> actions -> batch
  2. Verify that archived categories are present in the 'copy or move to category' dropdown

Third Test:
Verify that categories can be assigned archived categories as their parents

NOTE: If a published/unpublished category is assigned an archived category as its parent, then those categories also become archived.

Actual result BEFORE applying this Pull Request

  1. When editing an article assigned to an archived category, the category dropdown did not show the archived category.
    If the category of an article was archived then, it would be changed to an available non-archived category upon editing the article.

  2. Archived categories were not listed in the batch "Select Category for Move/Copy" dropdown

  3. Cannot assign archived categories as parent to other categories.

Expected result AFTER applying this Pull Request

  1. Category drop-down when editing an article shows archived categories. Archived categories assigned to articles don't get swapped for non-archived categories

  2. Archived categories are listed in batch "Select Category for Move/Copy" dropdown.

  3. Archived categories can be assigned as parent to other categories

Link to documentations

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

avatar hiteshm0 hiteshm0 - open - 18 Jan 2026
avatar hiteshm0 hiteshm0 - change - 18 Jan 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jan 2026
Category Administration com_categories Layout
avatar hiteshm0 hiteshm0 - change - 18 Jan 2026
Title
Archived categories are no longer treated as invalid categories
[6.1] Archived categories are no longer treated as invalid categories
avatar hiteshm0 hiteshm0 - edited - 18 Jan 2026
avatar hiteshm0 hiteshm0 - change - 18 Jan 2026
Title
[6.1] Archived categories are no longer treated as invalid categories
[6.1] Include archived categories in edit and batch dropdowns
avatar hiteshm0 hiteshm0 - edited - 18 Jan 2026
avatar brianteeman
brianteeman - comment - 18 Jan 2026

i wonder why we have never been able to do this before. As far as I can tell the behaviour has been this way for at least 8 years and probably longer


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46706.

avatar hiteshm0
hiteshm0 - comment - 18 Jan 2026

@brianteeman
It is definitely possible that the BEFORE of this PR was intended, considering the archived = finished / don't assign anything more here philosophy.
And this PR solves the problem of not being able to assign archived category for a new article( or as parent to a different category ) , which might be a very small use case while introducing new dropdown elements ( confusion ) to every user.

But it fixes the bug where an archived category would get swapped out for the first available non-archived category which is an improvement.

Would be glad to hear some advice on how to progress with this further.

avatar chmst
chmst - comment - 18 Jan 2026

I have two categories:
jobs (alias: jobs-archived)
jobs (alias: jobs)

grafik

The user does not see which category to choose.

In category edit view, the archived category is marked with [..].

grafik
avatar peterhulst
peterhulst - comment - 18 Jan 2026

@chmst In category edit view [jobs] means: unpublished instead of archived. Archived categories are not visible in this view. Archived categories are also not visible in batch process of categories.

avatar peterhulst
peterhulst - comment - 18 Jan 2026

@hiteshm0 I have tested 5ced8fa
it succesfully in Joomla 5.4.2.

avatar chmst
chmst - comment - 18 Jan 2026

@peterhulst you also have to think about side effects. For batch process, the result is not acceptable.
@hiteshm0 could you enclose archived categoriesl in brackets also in the dropown for batch process?

avatar hiteshm0
hiteshm0 - comment - 18 Jan 2026

@chmst yes, i am working on it right now.
both unpublished and archived categories will be enclosed in brackets in the dropdown for batch process ( same as category edit view )

avatar hiteshm0 hiteshm0 - change - 18 Jan 2026
Labels Added: Feature b/c break PR-6.1-dev
avatar hiteshm0
hiteshm0 - comment - 18 Jan 2026

@chmst non-published categories should now have brackets around them in the batch operations dropdown.

avatar chmst
chmst - comment - 18 Jan 2026

Thank you @hiteshm0 for the change, but this is not what we do in Joomla. We separate data and presentation layer.
No database queries in layouts.
You could add the published field into the categories (this means change the categries model) so it is available in the layout.

Another solution would be: Let the code as it is now, filter = 0, 1.
Then make an new select with filter = 2. This gives the arcived categories.
Build the final drop down in two parts - first the published categories as it is now,

then append '- archived categories -' (use a language key)
and the all the archived categories.

This seems less confusing than having prublished and archived categories mixed in a dropdown.

avatar peterhulst
peterhulst - comment - 18 Jan 2026

@hiteshm0 and @chmst 👍

I have checked e580fa5 and it works as expected.

Proposal:
To overcome the comment of @chmst instead of [] for both unpublished and archived categories, the archived categories can be enclosed with {} instead [] (or something else: - archived categories -' (using a language key))

The code change in the latest modification is easy:
in item.php
if (isset($publishedStates[$catId]) && $publishedStates[$catId]->published != 1) {
$option->text = '[' . $option->text . ']';
}

Change to:

if (isset($publishedStates[$catId]) && $publishedStates[$catId]->published == 0) {
    $option->text = '[' . $option->text . ']';
}

if (isset($publishedStates[$catId]) && $publishedStates[$catId]->published == 2) {
    $option->text = '{' . $option->text . '}';
}

And in components\com_categories\src\Field\CategoryeditField.php:

        if ($option->published == 1 ) {
            $option->text = str_repeat('- ', !$option->level ? 0 : $option->level - 1) . $option->text;
        } 

Change to:

        if ($option->published == 1 ) {
            $option->text = str_repeat('- ', !$option->level ? 0 : $option->level - 1) . $option->text;
        } 			
		elseif ($option->published == 0) {
			$option->text = str_repeat('- ', !$option->level ? 0 : $option->level - 1) . '[' . $option->text . ']';
		}
		elseif ($option->published == 2) {
			$option->text = str_repeat('- ', !$option->level ? 0 : $option->level - 1) . '{' . $option->text . '}';
		}

        // Displays language code if not set to All
        if ($option->language !== '*') {
            $option->text .= ' (' . $option->language . ')';
        }

Regards,
Peter

avatar hiteshm0
hiteshm0 - comment - 18 Jan 2026

@peterhulst your proposal definitely works but as mentioned by @chmst it is not in joomlas practice to do database queries in layouts, so the solution will become quite complicated.

avatar chmst
chmst - comment - 19 Jan 2026

@hiteshm0 The proposal of @peterhulst means that you can remove the database access. You need only the extra line for archived categories.
But then we have two or three database queries instead of one.

Layout: At the moment, there is no difference for published and unpublished categories - but could be interesting.
What would you expect as administrator if you have hundreds of categories?
Would be nice to have more opinions - @brianteeman

avatar brianteeman
brianteeman - comment - 19 Jan 2026

if we dont display any difference between published/unpublished categories then I wouldnt expect any visual difference with archived

avatar brianteeman
brianteeman - comment - 19 Jan 2026

If archived is going to be displayed in the select lists then should it also be displayed in the list views. Currently archived is only displayed in the status filter is set to all

image
avatar brianteeman
brianteeman - comment - 19 Jan 2026

i dont understand why this is labelled a b/c break. Nothing breaks you just get extra functionality

avatar hiteshm0
hiteshm0 - comment - 19 Jan 2026

@brianteeman its most probably labelled as a b/c break, because in the batch operations dropdown there is no difference in the way archived and published categories are shown ( even unpublished categories are shown without any brackets ).
I am working on a fix for this right now

avatar brianteeman
brianteeman - comment - 19 Jan 2026

That doesn't constitute a breaking change

avatar joomla-cms-bot joomla-cms-bot - change - 19 Jan 2026
Category Administration com_categories Layout Administration com_categories Language & Strings Layout Libraries
avatar hiteshm0
hiteshm0 - comment - 19 Jan 2026

quite a bit of duplicate code in CategoryeditField.php

avatar peterhulst
peterhulst - comment - 19 Jan 2026

I have checked both changes succesfully in Joomla 5.4.2. Thank you! Nice implementation!

avatar richard67
richard67 - comment - 21 Jan 2026

@peterhulst If you have successfully tested this pull request, then please go to it in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/46706 and use the blue "Test this" button at the top left corner to submit your test result. I think I've told you that a few times in last already.

avatar peterhulst peterhulst - test_item - 21 Jan 2026 - Tested successfully
avatar peterhulst
peterhulst - comment - 21 Jan 2026

I have tested this item ✅ successfully on 458aa6e

I have verified it succesfully in J5.4.2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46706.

avatar peterhulst
peterhulst - comment - 21 Jan 2026

@richard67 sorry, i'm a test beginner and i didn't know from the blue test button. It was never told to me.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46706.

avatar HLeithner
HLeithner - comment - 23 Jan 2026

I see no b/c break at the first glance so I removed it maybe @chmst can explain why she added it.

I'm a bit confused about the duplicated code in CategoryeditField::getOptions(), I didn't a full code review just wondering if the code you added isn't the same already in the method.

avatar hiteshm0
hiteshm0 - comment - 23 Jan 2026

@HLeithner there was an existing database query for category state = 0,1 in getOptions. I added another database query for category state = 2. The ACL filtering logic that succeeds both these database queries is identical.

avatar hiteshm0 hiteshm0 - change - 24 Jan 2026
Labels Added: Language Change PBF
Removed: b/c break
avatar hiteshm0
hiteshm0 - comment - 24 Jan 2026

@HLeithner
-> By default a database query for category published state = 0,1,2 is run. All filtering logic happens only once.
And then a separator is put between active and archived categories.
-> If need be the required published states can be explicitly mentioned through the XML.

avatar HLeithner
HLeithner - comment - 24 Jan 2026

tbh why to separate them? it's isn't it annoying if you have a tree structure and the archive which should be in the 5th subtree item is not there?

avatar hiteshm0
hiteshm0 - comment - 24 Jan 2026

@HLeithner
i just felt like this was the more cleaner approach as it shows archived categories in the end ( practically assigning of archived categories will be rare ). And unpublished categories are visually indicated using [], so we'll have to use {} to indicate archived categories which might become cluttered.

Implementation wise using {} to indicate archived categories is simpler than separating and showing in the end.

Some advice and opinions from end users could be valuable here

avatar HLeithner
HLeithner - comment - 24 Jan 2026

you can make it italic, not sure if it works in all browsers, but would make it nicer I think.

avatar hiteshm0
hiteshm0 - comment - 24 Jan 2026

ill add curly braces around the archived categories to make sure there is consistency with how we use square brackets for unpublished categories

avatar joomla-cms-bot joomla-cms-bot - change - 24 Jan 2026
Category Administration com_categories Layout Language & Strings Libraries Administration com_categories Layout Libraries
avatar hiteshm0
hiteshm0 - comment - 24 Jan 2026

@HLeithner
Separation between active and archived categories has been removed.
[] brackets around unpublished categories and {} brackets around archived categories as their respective visual indicator has been added.

( if you'd prefer me not pinging you, please let me know 😅 )

Edit: The failed check will most probably pass upon rerunning the check. But i am unable to rerun checks for some reason.

avatar HLeithner HLeithner - change - 24 Jan 2026
Labels Removed: Language Change
avatar HLeithner
HLeithner - comment - 24 Jan 2026

@hiteshm0 since I'm one of the 2 release manger for 6.1 it's ok when you ping me.

would you do me a favor and check convert all double equal checks to tripple equal checks.
$item->published == 2 to $item->published === 2

if $item->published is not an integer please case it to int, but we nice if you could test first if it's an integer on your installation.

avatar hiteshm0
hiteshm0 - comment - 24 Jan 2026

@HLeithner
$item->published is an integer in my installation so ill skip on casting it to int.

ive changed all the '==' that ive added to '===' ( there were 6 of them )

avatar chmst
chmst - comment - 24 Jan 2026

We don't have many use cases in real life so it is hard to decide what is better UX.

Normal users I don't know what italic or a special kind of bracket means. Is it archived, is it unpublished, is it trashed?
This is not self-explaining.
Maybe the usual icon or an additional text is better?

  • category a (archived)
  • category a (unpublished)

Suppose you have 200 catregories until now and work with them since years. Suddenly the dropdown contains 400 categories, all the archived categories are mixed in between. Better or worse?

avatar HLeithner
HLeithner - comment - 24 Jan 2026

I would say better in between. It's more strange if you need to have the same tree 2 times in the dropdown.
Maybe it's better to not mark it at all, or append "(archived)" and "(unpublished)" but I think unpublished is not needed. I'm open to how and if it's marked, what I don't think is a good idea to separated it at the bottom.

avatar chmst
chmst - comment - 25 Jan 2026

Ok for having one tree.
But we need the additional text - at least (archived) - for accessibility and usabiltiy. Also possible is an icon (must be implemented in an accessible way).

avatar hiteshm0
hiteshm0 - comment - 25 Jan 2026

@HLeithner @chmst
A couple of options we could explore:

image
  1. Appending (Unpublished) and (Archived)
image
  1. Appending (U) and (A) to keep things minimal

would you guys prefer something else ?

avatar peterhulst
peterhulst - comment - 25 Jan 2026

@hiteshm0 I prefer the (A) and (U) display. It is more compact.
When you make a language STRING of (A) and (U), it is easily to modify in future in case needed.

avatar brianteeman
brianteeman - comment - 25 Jan 2026

a and u might make sense in english but who knows about all the other supported languages. The words might start with the same letter

avatar ot2sen
ot2sen - comment - 25 Jan 2026

a and u might make sense in english but who knows about all the other supported languages. The words might start with the same letter

Indeed that is the case for more languages. Danish would be (A) arkiveret and (A) afpubliseret.

avatar crimle crimle - test_item - 30 Jan 2026 - Tested successfully
avatar crimle
crimle - comment - 30 Jan 2026

I have tested this item ✅ successfully on 1dee2b8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46706.

avatar JeroenMoolenschot JeroenMoolenschot - test_item - 31 Jan 2026 - Tested successfully
avatar JeroenMoolenschot
JeroenMoolenschot - comment - 31 Jan 2026

I have tested this item ✅ successfully on 1dee2b8


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46706.

Add a Comment

Login with GitHub to post a comment