Problem/Motivation

Changes to the order of taxonomy elements are not saved.

After upgrading from Drupal 11.2 to 11.3, changes to the order (organization) of terms are not saved.
Changes are also not saved after manually changing the row weight key value.

Steps to reproduce

Proposed resolution

Remaining tasks

Needs steps to reproduce

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

pingwin_cracow created an issue. See original summary.

elfakhar’s picture

I have tested this issue in a clean local environment:
Drupal 11.2.7:

  • Created a vocabulary with multiple taxonomy terms.
  • Reordered terms via drag-and-drop and by changing weights manually.
  • Result: order saved correctly.

Upgraded to Drupal 11.3.1:

  • Ran database updates and cleared caches.
  • Retested the same vocabulary.
  • Result: order continues to save correctly; no regression observed.

Environment: PHP 8.3.6, MariaDB 10.11 (Docker), core only.
I could not reproduce the issue in this environment.

pingwin_cracow’s picture

I upgraded to PHP 8.4 and tried PHP 8.5, but several modules showed incompatibility errors with PHP > 8.3.
So I reverted to PHP 8.3.

I don't know, but it might be related to the PHP upgrade to >8.3 and something went wrong after reverting to PHP 8.3.
How can I check and possibly fix this?

I've cleared the cache numerous times, run cron, and updated.php, but none of this has improved.
Is there any way to fix this?

pingwin_cracow’s picture

PS.
I created a new dictionary and added a few terms, all of which received a weight of 0.
Attempting to change the position value is not saved in the database.

elfakhar’s picture

This does not appear to be a core regression.
It may be worth checking for any pending entity or database updates, and reviewing whether a contrib or custom module affects taxonomy term saving or ordering

pingwin_cracow’s picture

Thank you for the information.

For me:
php 8.3
D 11.3.1
all modules up to date
I don't see any errors except for one log entry:

Drupal\Core\Field\FieldException: Attempted to create, modify, or delete an instance of a field with the name w3css_content_title on entity type paragraph when the field storage does not exist. in Drupal\field\Entity\FieldConfig->getFieldStorageDefinition() (line 318 of /home/xxx/ftp/PROJECT/project.pingwin/web/core/modules/field/src/Entity/FieldConfig.php).

#0 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1643): Drupal\field\Entity\FieldConfig->getFieldStorageDefinition()
#1 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(573): Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object(Drupal\field\Entity\FieldConfig), 50)
#2 /home/pogoria/ftp/PROJECT/project.penguin/web/core/modules/field/field.purge.inc(82): Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object(Drupal\field\Entity\FieldConfig), 50)
#3 /home/pogoria/ftp/PROJECT/project.penguin/web/core/modules/field/src/Hook/FieldHooks.php(183): field_purge_batch(50)
#4 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Cron.php(275): Drupal\field\Hook\FieldHooks->cron()
#5 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(340): Drupal\Core\Cron->Drupal\Core\{closure}(Array, 'field')
#6 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Cron.php(258): Drupal\Core\Extension\ModuleHandler->invokeAllWith('cron', Object(Closure))
#7 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/Cron.php(97): Drupal\Core\Cron->invokeCronHandlers()
#8 /home/pogoria/ftp/PROJECT/project.penguin/web/core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php(37): Drupal\Core\Cron->run()
#9 /home/pogoria/ftp/PROJECT/project.penguin/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate(Object(Symfony\Component\HttpKernel\Event\TerminateEvent), 'kernel.terminat...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#10 /home/pogoria/ftp/PROJECT/project.penguin/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}(Object(Symfony\Component\HttpKernel\Event\TerminateEvent), 'kernel.terminat...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#11 /home/pogoria/ftp/PROJECT/project.penguin/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'kernel.terminat...', Object(Symfony\Component\HttpKernel\Event\TerminateEvent))
#12 /home/pogoria/ftp/PROJECT/project.penguin/vendor/symfony/http-kernel/HttpKernel.php(114): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\TerminateEvent), 'kernel.terminat...')
#13 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#14 /home/pogoria/ftp/PROJECT/project.penguin/web/core/lib/Drupal/Core/DrupalKernel.php(719): Drupal\Core\StackMiddleware\StackedHttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#15 /home/pogoria/ftp/PROJECT/project.penguin/web/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
#16 {main}

I don't know if this affects the taxonomy module.
I don't know what to do about it, and what custom module might affect the problem of saving taxonomy term ordering.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce
fmay’s picture

StatusFileSize
new51.6 KB

Hello,
I have the same problem. The only way is to force the #submit on the submit button in /web/core/modules/taxonomy/src/Form/OverviewTerms.php

screenshot

barakgalili’s picture

In my case the problem was in taxonomy_unique, The module add a submit function and dosen't deal with the weight order.
After removing the contrib module it's working but it need a second refresh to show the changes. Caching problem ?

quietone’s picture

Version: 11.3.x-dev » 11.x-dev

Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies. Thanks.

This still needs steps to reproduce the issue starting from "Install Drupal core".

fmay’s picture

I found that, in my case, the problem comes from the rabbit hole module (rh_taxonomy).

fmay’s picture

StatusFileSize
new778 bytes

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

anybody’s picture

I can confirm that we just ran into the same issue and it seems to have started with Drupal 11.3. I already left a comment here: https://www.drupal.org/project/drupal/issues/2856660#comment-16479333

We're also using rabbit_hole, but the patch from #12. It was also reported here: #3567965: Rabbit Hole settings are shown on vocabulary overview form and I raised the priority to Critical there.

Still I wonder why the fix is not enough in our case. I need to uncomment the submit callbacks of all modules that add their third party settings to the taxonomy term overview page to make it work again. Modules that use entity builders instead work great!

Is there any known regression in core regarding form submit handlers that could cause this?

Regarding #3 I think this issue should fix it: #3533870: Change the way Third Party Settings are set but there are still many other modules that use submit callbacks that were working before.

ronchica’s picture

This is a problem for us on an 11.3.2 install.

We need the patch in #12 in order to save the taxonomy term page. It is a Rabbit Hole problem.

The fix is similar to the 2.x issue here: https://www.drupal.org/project/rabbit_hole/issues/3567965

andreas_konstanz’s picture

I just run in the same issue. I'm not using Rabbit Hole. I'm using the Taxonomy Views Integrator (TVI) module which may be the cause of the problem.
Newly entered terms are displayed with a weight of 0. Changes are not saved, regardless of whether you enter new weight values or position the terms using drag and drop.
I have two identical Drupal installations, both with TVI activated, one running on Drupal 11.2 without any sorting issues, the other on Drupal 11.3.3 with the problems described.

anybody’s picture

@andreas_konstanz I think TVI might also be affected by the same (wrong) handling as described in #3533870: Change the way Third Party Settings are set

Maybe you'd want to create an issue at TVI linking that and this issue and also link it here?
Maybe you can even provide a similar MR for the fix over there?

The rabbit_hole issue has been fixed here: #3567965: Rabbit Hole settings are shown on vocabulary overview form but there's no tagged release yet.

danflanagan8’s picture

Thanks for everyone's comments on this. I was so confused and never would have figured this out.

I ran into this on D11.3 and we're using TVI, so that's probably our problem. Per @anybody's suggestion, I went to the TVI to create an issue based on the Rabbit Hole one, but luckily it already existed and is already fixed: #3576542: TVI form should not be present on term listing and breaks the taxonomy term sorting functionality

anybody’s picture

Please note that there are several modules that are affected by this, see above. If anyone finds further ones, please list them here and get them fixed :)

anybody’s picture

dunx’s picture

I have the same issue with a fresh install of Drupal CMS this morning - current stable version locally under ddev.

To recreate issue:

  1. mkdir DCMS2
  2. cd DCMS2
  3. ddev config --project-type=drupal11 --docroot=web --php-version=8.3
  4. ddev start
  5. ddev composer create drupal/cms
  6. ddev launch
  7. Install the site with Starter theme.
  8. No additional modules, themes or recipes installed at all (rabbit_hole or otherwise).
  9. Create a new taxonomy.

So very easy to recreate.

I can drag and drop the terms to reorder them and see the message '* You have unsaved changes.' but there is no way to save the new order - no Save button at the top or bottom of the page and no autosave happening. Same occurs if using row weights. This feels like a significant regression somewhere.

Top of screen - no option to save:
Only local images are allowed.

Bottom of screen - no option to save:
Only local images are allowed.

anybody’s picture

@dunx which contrib modules are enabled that could break this? Do you see any settings on the taxonomy terms list page? (not part of your screenshot).

I think one of the related contrib modules is causing this. The root cause in these IMHO is #3533870: Change the way Third Party Settings are set - they all should implement their third party settings this way to solve the issue. Seems something in D11 broke that.

I already found several contrib modules causing this issue. TVI, Rabbit Hole, Simplify, ... Let's get this fixed together!

anybody’s picture

Status: Postponed (maintainer needs more info) » Active

PS: Might still be a different issue. Did you check the browser console? And as I saw you're using the new Navigation module that moves the "Save" button to top right - I guess this might be a conflict around that in your case!

But what ever causes this for a fresh Drupal CMS installation - it's major!

dunx’s picture

As per 8 above: "No additional modules, themes or recipes installed at all (rabbit_hole or otherwise)."

So fresh install of Drupal CMS with nothing touched. Error is adding and trying to re-order a taxonomy.

Should I raise a separate issue on Drupal CMS or let it work through here?

quietone’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

Reading the comments this does not appear to be an issue for Drupal core. This still needs steps to steps to reproduce the issue starting from "Install Drupal core". Postponing on this step.

@dunx, Yes talking to the Drupal CMS folks might help. There is also a support channel for drupal cms, #drupal-cms-support.
V

dunx’s picture

Created https://www.drupal.org/project/drupal_cms/issues/3585951 for Drupal CMS and added this issue as related.

dunx’s picture

vensires’s picture

Just for clearance, I don't know if this is still valid for Drupal core but from my research, #3585951: Form actions require clear cache to be displayed in the toolbar is related to the Gin theme itself.

ckaotik’s picture

We had this issue too, but in our case it was due to a custom template for links. This caused the link to render but not its children, which the overview form uses during processing.

Error messages shown were for example

Warning: Trying to access array offset on null in Drupal\taxonomy\Form\OverviewTerms->buildForm() (line 210 of /var/www/html/web/core/modules/taxonomy/src/Form/OverviewTerms.php)

-> in our case, it was not a core issue