I'm currently creating a custom 'sticky' queue handler that will keep entities containing a boolean field with a true value in the same position in the queue, no matter what is added to the queue, until the user manually removes the sticky item from the list.
In order to do this cleanly, I need someway to override the entityreference behavior on only this queue type. Specifically, I need to write new implementations of the validate() and presave() methods of EntityReferenceBehavior_EntityQueue to calculate the new order of the queue.
I didn't see anyway to do that without modifying the module code. If there's a different way I should be approaching this, I'm open to that as well. Would be willing to try to create a patch if I can get some direction as to how to proceed. Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | behavior-per-handler-2448115-1.patch | 6.02 KB | bropp |
Comments
Comment #1
bropp commentedFirst attempt at a patch.
Creates two new methods on the queue handler: validateItems() and preSaveItems(). These are called inside of the entityreference behavior allowing each queue type to have its own implementation if desired.
The simple queue is given the current behavior implementation (from which multiple subqueue inherits), so no default functionality should differ.
Comment #2
jojonaloha commentedI haven't tested it yet, but I think the implementation looks solid. I'm just curious why you can't subclass
EntityReferenceBehavior_EntityQueue? Think I just need an explanation of how this solves the problem where subclassingEntityReferenceBehavior_EntityQueuewon't.Also, I think you'll need to change
$queueto$this->queuein theSimpleEntityQueueHandlermethods.Comment #3
amateescu commentedClosing issues for the 7.x version, which is not supported anymore.