Hello,
first and foremost, I did search around the issue queue for my specific problem, but could not find something related to my problem, (except one, which I'll link to in a minute).
Problem :
I have a vocabulary consisting of three parents, and each of those parents has a lot of children, which in turn have a lot of children (max_level : 4). And I do mean a lot : first parent has 250 + terms alltogether.
When I go the the Term Overview page, I see all of the children of the first parent, and the pager says 3 pages are to follow. Now what happens is, if I go the next page I see the exact same output of the first page, and my second parent at the bottom. The same happens when I go to page 3, but then it shows the remaining 2 parent terms.
Research :
I've been digging in code (more specifically in /core/modules/taxonomy/src/Form/OverviewTerms.php ) where I came across this code :
// Do not let a term start the page that is not at the root.
$term = $tree[$tree_index];
if (isset($term->depth) && ($term->depth > 0) && !isset($back_step)) {
$back_step = 0;
while ($pterm = $tree[--$tree_index]) {
$before_entries--;
$back_step++;
if ($pterm->depth == 0) {
$tree_index--;
// Jump back to the start of the root level parent.
continue 2;
}
}
}
Now, what I believe this does is quite simple : when deciding the terms to render on a page, it checks if a term is indeed at the root level before 'cutting it' at that term and displaying the rest at the next page. What happens in my case is that , because I have 3 parent terms and the first one has 250+ children, the parent and its children are all displayed on the pages, because it never gets to 'cut' the array of terms to show.
Hence, it just shows everything until it reaches the next root (which is my second parent).
(I know, my phrasing could be a bit better, but I believe you know what I mean :) )
The pagination just says three pages, because it divides the total number of terms (250+) in 'chunks' of 100 (the setting in taxonomy config files).
Now, I do believe this 'works as designed', because the pagination is correct in assuming there will be three pages (in my case), but there should be a better way to display a root parent term with 100+ terms, because this is the real issue here : any root parent term with 100+ children will be displayed in this manner.
I do believe this is related to https://www.drupal.org/node/242324 , which is where this code was introduced in the first place. And for 99% of the websites, this will work like a charm, but in this case it does not :)
ATM I'll be investigating contrib modules to adress this problem, as I do not see an easy solution for this. I just thought I'd mention this problem.
I haven't supplied screenshots, because of the amount of terms. If need be, I'll supply some.
Comments
Comment #2
ashopin CreditAttribution: ashopin at Portage CyberTech commentedI can confirm that we're seeing the issue as well with a top level item with a lot of children.
In our case, changes to the page don't save.
Comment #3
mattjones86I've got the same issue, only it's worse because I'm looking at ~2000 children split over 5 or 6 levels.
All these are contained within 3 top level parents and actually causes the browser to freeze for long periods of time as it init's the drag and drop.
I believe this a functionality breaking bug for some use cases and should be considered more important than 'Minor' as it renders the interface completely unusable for large hierarchical taxonomy (like categories). I'm bumping to Normal in the hope it gets some more attention.
There should really be a separate vocabulary configuration option available which allows only one level of terms to be displayed at a time, perhaps showing the number of children contained underneath and the option to dig down to the next level or navigate back up to a higher level within the taxonomy.
Does anyone know of a contrib module which solves this problem?
EDIT: taxonomy_manager seems to do a pretty decent job at solving this, but it would still be nice to have something included in the core.
Comment #5
greendemiurge CreditAttribution: greendemiurge commentedI spent some time looking into this and I agree it does run painfully slowly when a large number of subordinate terms are linked. The code section in question does indeed ensure that the tree rendered to the page must start on a root item.
Design-wise, I could see a solution where we permitted a continuation of listings on a subsequent page, such as:
That would not be too difficult to accomplish, but I see 2 major issues with the design:
1) Re-ordering weights via dragging would not be workable. Granted they would work super-slowly with a large data set, but they would not work at all if the page truncates the list.
2) Multiple layers of nesting would be visually confusing. The above example isn't awful, but what if we ended up in a place where we had this:
That would be pretty nightmarish, if rare.
The way I see it, what we have may be the least-worst scenario already. taxonomy_manager may be the best way to go for edge cases.
The one thing I would point out, though, is that the pager is currently buggy. If you have 1000 sub-categories nested in 2 categories, and a max of 100 records per page, you get a pager with 11 pages, all of which have the exact same content on them, because apparently the pager just divides the number of records total by the number per page. Clearly it would be better if we ensured that the 2 root categories ended up each with their own page and only had 2 pages in the pager.
Comment #6
rojan raj CreditAttribution: rojan raj commentedI am having the same issue as well. Any solutions or patches?
Comment #8
kyuubi CreditAttribution: kyuubi commentedBumping into this as well.
Comment #9
usmanjutt84I can confirm this bug as well.
I have 200+ parent terms and have 21000+ its child and its child (3 Level). The pagination is correct.
One parent has 1050 child+sub-child. This parent located on /admin/structure/taxonomy/manage/VOCAB_NAME/overview?page=48 and all 1050 terms is rendered on the same page.
Technically, 1050 terms should have 11 pages in pager and 1st page starts at /admin/structure/taxonomy/manage/VOCAB_NAME/overview?page=48 for this parent. These 1050 terms repeats on the next 10 pages as well until we reach at 58.
Looking forward from the community for solution.
Comment #10
usmanjutt84As #3 said
This issue should not be on Normal priority. We should consider it as critical.
Comment #11
catchhttps://www.drupal.org/core/issue-priority has the criteria for issue priority. Given this is causing browsers to lock up on those pages, it can probably be considered major, but given it's isolated to one admin page, it would be more properly normal. Moving to 'major' for now.
Note that there are contrib modules that replace the taxonomy administration interface like https://www.drupal.org/project/taxonomy_manager
This probably can't be fixed without a complete refactoring of drag and drop hierarchy.
Comment #13
kyuubi CreditAttribution: kyuubi commentedBear in mind that https://www.drupal.org/project/taxonomy_manager is currently not being properly maintained in D8 afaik.
For example https://www.drupal.org/project/taxonomy_manager/issues/3046752 which makes the module pretty much unusable for fielded terms has been opened for a year.
Comment #19
miha.wagner CreditAttribution: miha.wagner commentedCan also confirm this is an issue on parents with several hundred children.