We have a site that uses a simple queue to manage what shows up in a view. It is a fairly straight forward event content type with a few fields. The queue was working fine for a few weeks, then I got a report that the labels where all gone and then couldn't update it. We had installed language modules for translation of some content after the queue went in and I figured that somehow that had messed up the config. I removed the queue and rebuilt it. I could add items again. All seemed better.

Then it happened again. Now, I have been taking a closer look and am not sure what to make of it. The queue had 6 items in it and it showed the six spots but none had labels. An inspection of the entity_subqueue_field_data table showed the 6 rows.

The real head scratcher is that if I try to add another item to the list today, the only item available is labeled "Upcoming events" (this is the name of the simple queue) which when I add it and click the edit link takes me to the edit form for this simple queue.

The reference method is set to default. If you have any suggestions on how I can get to the root cause of this issue, I would be appreciate it. I attached a screenshot of the messed up queue.

Exact instructions to reproduce on newly installed Drupal 8.9.1-dev.

  1. Install and enable entity_queue
  2. Create a simple queue. Use content / nodes for target but entity type is unimportant.
  3. Add one item.
  4. Check /admin/structure/entityqueue and click "Edit Items" for your new queue. Looks good so far.
  5. Enable Content Translation and Language modules.
  6. Check the queue's "Edit items" again. Still looks good.
  7. Go to /admin/config/regional/content-language. Don't select anything, just hit "Save Configuration". URL alias being checked or not is unimportant.
  8. Check queue's "Edit items" again. The queue items are now blank as shown in @maddentim's screenshot.

I have done some debugging on this. I'll add results in a comment below.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maddentim created an issue. See original summary.

tetranz’s picture

Priority: Normal » Major

I was just about to report this. I have some debugging info which I'll post in a moment.

I'm bumping this to Major because it's a complete showstopper on any multi-lingual site.

tetranz’s picture

Issue summary: View changes
tetranz’s picture

I think this might be a Drupal core issue rather than entity queue. It seems to have been around for a while. I confirmed it on 8.7, 8.8 and 8.9.

It is related to the fact that the target type for the items field of entity_subqueue is set per bundle. Also, content translation creates base field overrides. The base field override loses the fact that the target type is set per bundle so it defaults back to entity_subqueue.

Here's some test code for my queue called test.

    $subqueue = EntitySubqueue::load('test');

    /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $efm */
    $efm = \Drupal::service('entity_field.manager');

    /** @var \Drupal\Core\Field\BaseFieldDefinition $items_defs */
    $items_def = $efm->getFieldDefinitions('entity_subqueue', 'test')['items'];
    $settings = $items_def->getSettings();

Screenshot

The override looks like this (pasted from yaml)

uuid: be7b6eaa-1952-40c4-93c2-5b1fb429c867
langcode: en
status: true
dependencies:
  config:
    - entityqueue.entity_queue.test
id: entity_subqueue.test.items
field_name: items
entity_type: entity_subqueue
bundle: test
label: Items
description: ''
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings:
  handler: default
  handler_settings: {  }
field_type: entity_reference

The override is applied in Drupal\Core\Entity\EntityFieldManager::buildBundleFieldDefinitions It gets the bundle field definition correctly but a few lines down it is overridden by the override.

As I said, this might be a core issue but it's good to get some visibility here. I think the problem really happens when the override is created in Drupal\Core\Field\Entity\BaseFieldOverride. The createFromBaseFieldDefinition method is not capturing all the bundle specific config.

tetranz’s picture

Issue summary: View changes
tetranz’s picture

Title: Simple queue looses labels, cannot add new ones » Simple queue looses labels, cannot add new ones. Unusable on multi-lingual sites.
catch’s picture

tetranz’s picture

Here's a patch that I think is a solution for most people.

I looked at the Comment module because it has essentially the same problem with its entity_id field. It avoids the problem simple by making the field non-translatable. I think we can do the same here.

Is there a good reason for the items field to be translatable? That is probably a matter for discussion. Would you ever want different translations of a queue item pointing to a different entity? I think you'd instead want to point to different translations of the same entity but I'm not sure about that so perhaps this patch is not for everyone.

mahseri’s picture

Status: Active » Reviewed & tested by the community

I'm facing the exact same issue.
In my case, I don't want the items field to be translatable, so the patch works perfectly for me.

Thank you.

tetranz’s picture

I foolishly left a couple of unnecessary use statements.

tetranz’s picture

Title: Simple queue looses labels, cannot add new ones. Unusable on multi-lingual sites. » Simple queue loses labels, cannot add new ones. Unusable on multi-lingual sites.
Status: Reviewed & tested by the community » Needs review

I should put this back to review. Also fixing a spelling typo in title.

lonalore’s picture

Status: Needs review » Reviewed & tested by the community

Patch #10 works for me. Thank you!

andrimont’s picture

The patch #10 works for me 2.
This is great ! I did freak out on the issue and was about to reinstall entityqueue . Thanks @tetranz

Ralf Eisler’s picture

The patch #10 works for, thank you very much!

  • amateescu committed 0839665 on 8.x-1.x authored by tetranz
    Issue #3150981 by tetranz, maddentim, catch: Simple queue loses labels,...
amateescu’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

It's unfortunate that we can't have translatable items per subqueue, but, as far as I see, there's no way around it. Any site that could have tried to use this functionality wouldn't have been able to do it because of the core bug (#2935978: Create a bundle_field_override configuration entity to override a bundle field with configuration).

Committed to 8.x-1.x, thanks a lot everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.