- π¦πΊAustralia dpi Perth, Australia
Can confirm with EQ 1.6.
When trying to add a node entity in context to a queue via `/node/{nid}/entityqueue`, wherein the queues are a subqueue(smartqueue).
The subqueues represent taxonomy terms. They are permitted to link to Content (aka node)
The following message is displayed:
The operation could not be performed for the following reasons:
This entity (taxonomy_term: 123456) cannot be referenced.I've traced this to what appears to be problems derived from the workaround hooks in
entityqueue_smartqueue_entity_field_storage_info
and/orentityqueue_smartqueue_entity_field_storage_info
When the validator attempts to determine the target entity type of the
attached_entity</cod> entity reference field grafted onto the <code>\Drupal\entityqueue\Entity\EntitySubqueue
entity, it still thinks the target type is entity_subqeueu, not taxonomy_term.Clues
An entity reference handler plugin is created in
ValidReferenceConstraintValidator.php
via$handler = $this->selectionManager->getSelectionHandler($value->getFieldDefinition(), $entity);
. This method gets the target type from the field storage definition, not the field instance. The target type configuration property therefore is pointing to entity_subqueue not taxonomy_term.
ValidReferenceConstraintValidator.php
calls$handler->validateReferenceableEntities($target_ids);
Eventually
validateReferenceableEntities
is called, and the ID validation is performed on the wrong table.Suggested solutions
Either the field storage alters are reworked so it doesnt need to hack in a different entity type in order to work around int/string issues. Perhaps the project should migrate to use https://www.drupal.org/project/dynamic_entity_reference β for the field storage to work around int/str in the same column.
Implement and configure a custom EntityReferenceSelection plugin, such that DefaultSelection is not used, which calls out to the undesired table.
- π¦πΊAustralia dpi Perth, Australia
Given above evidence I don't think this is specifically tied to taxonomy (though my example does reference terms)
- π¨π¦Canada slydevil Halifax
I ran into this issue, but my term is unpublished (using Content Moderation).
- π¨π¦Canada slydevil Halifax
Maybe related to this ore issue - https://www.drupal.org/project/entityqueue/issues/2383903 β .
Fixed my issue by creating an entity reference view and swapping the Reference Method of the queue from Default to the view.
- π¦πΊAustralia dpi Perth, Australia
Yeah, changing the EntityReferenceSelection to use something else is going to allow you to reference more items. But theres a chance you'll be able to reference target entities that it shouldnt be able to. Such as different entity types or bundles.
I see the best way forward as implementing our own EntityReferenceSelection plugin.
Yes I was going through the entityqueue module and i feel that it would be nice if there is a option to select the content types for subqueues too.