Nodequeue has an option to create a tab on Node pages that links to: node/%/nodequeue. Entityqueue could add a similar page. This page would allow you to see all the queues that the entity can be added to. For any queues that the entity is already in, it would show a "Remove from queue" link, otherwise it would show a "Add to queue" link.
The only thing I can see wrong with the Nodequeue's implementation, is if the same node is in the queue multiple times (assuming this bug #593468: adding the same node more than once to a queue causes bad behavior was fixed), then clicking "Remove from queue" only removes the first instance of the node in the queue. We may want to consider a "Remove all from queue" and maybe a "Remove from queue position X" to give the user more control over which one is removed from this page.
| Comment | File | Size | Author |
|---|---|---|---|
| #36 | interdiff-36.txt | 19.52 KB | amateescu |
| #36 | 2145441-36.patch | 17 KB | amateescu |
| #32 | 2145441-32.patch | 17.09 KB | rajab natshah |
| #31 | 2145441-31.patch | 12.94 KB | rajab natshah |
| #22 | entityqueue-add_entityqueue_tab-2145441-22.patch | 16.91 KB | josebc |
Comments
Comment #1
jamesdevware commentedHi,
I needed to do the same thing,
Attached is a module which I created to do exactly that (for nodes). I have quite a basic entityqueue setup but it works for what I needed.
Comment #2
joachim commentedBumping the version & upping to major. Now that this module is replacing nodequeue for D8, this is sort of a regression in the UX...
Comment #3
josebc commentedComment #4
josebc commentedCode is a little dirty but good for a start
Comment #5
rajab natshah+1 Testing :)
Comment #6
rajab natshahPassed
https://travis-ci.org/Vardot/varbase/jobs/175542568
Feature: Module Requirements - Standard Entity Queue Management - Have Entityqueue tab inside the full content page and be able to Add to a queue or Remove from a queue
Comment #7
rajab natshahComment #8
rajab natshahI have one issue for this patch.
The Entityqueue Tab will show up for content types which are not selected in any eneity queue
Comment #9
josebc commentednew patch with condition
Comment #10
rajab natshahTesting .......
Comment #11
rajab natshahPassed
https://travis-ci.org/Vardot/varbase/jobs/176355471
Comment #12
rajab natshahComment #13
amateescu commentedAs @josebc mentioned in #4, the code does look kinda dirty to me as well :)
Here's a small review for now:
The names of these operations are a bit vague, since they are not adding or removing subqueues, but subqueue *items*, so how about renaming the links to "add-item" and "remove-item", and everywhere they're used as well.
All methods from this controller could actually move to the existing
\Drupal\entityqueue\Controller\EntityQueueUIControllerclass.Instead of the hackish code in
\Drupal\entityqueue\Entity\EntitySubqueue::toUrl(), why don't we add the parameter directly where we need it?Needs to be done, I think?
:)
This can just be ::allowed() and ::forbidden().
Do we really need this weight so high? If yes, I'm very curious why :)
Comment #14
josebc commentedamateescu thanx for the review, ill be working on your notes however i still think this needs some more work (ie. AJAX replace instead of refresh on success).
Will upload a new patch soon
ps: Im still a D8 noob
Comment #15
rajab natshahGrate work!!!
My only wish will be if we could have a custom label for the tab.
Comment #16
amateescu commented@josebc, D8 noob or not, you're doing a very good job :)
Comment #17
josebc commentednew patch with review feedback and some cleanup
Comment #18
amateescu commentedCan you please provide an interdiff so it's easier for a reviewer to see exactly what changed from the previous patch?
Comment #19
josebc commentedinterdiff
Comment #20
rajab natshahTesting .....
Comment #21
rajab natshah- Not up to date with the latest DEV.
- ( Suggestion )
Comment #22
josebc commentedReroll for latest dev
Comment #23
rajab natshahTesting ....
Comment #24
rajab natshahSeems that it's an issue with #2836404: Subqueues should not have a canonical link in order for them to be exportable through REST
Comment #25
rajab natshahComment #26
rajab natshahThe patch is not working with the latest Entityqueue release.
Comment #27
abu-zakham commentedPatch #22 works fine on latest dev version, Thanks @josebc.
Comment #28
rajab natshahTesting ... with e17c172fe1bfdab2194b06b848cad92bc6824e49 and the patch.
We had an issue with:
#2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it
Comment #29
rajab natshahComment #30
rajab natshahPassed
We need to apply #2479377: content_translation_page_attachments() should check for a canonical link before generating a URL to it on drupal.
Comment #31
rajab natshahUpdated the patch to work with Drupal 8.4.0-rc2
as we had this issue #2913504: PHP Fatal error: Call to a member function getEntitySettings() on null in entityqueue/src/Controller/EntityQueueUIController.php on line 219
Comment #32
rajab natshahComment #33
dennis cohn commentedI've deleted an entityqueue. And now I get a fatal error when I go the the entityqueue tab:
Error: Call to a member function getEntitySettings() on null in Drupal\entityqueue\Controller\EntityQueueUIController->entityGetAllowedSubqueList()
Can't add/edit anything from the node form anymore.
Comment #34
millionleaves commentedI just tried patch #32 on the dev release from October 20, 2017 in a site running Drupal 8.4.2.
I get this error when clearing the cache:
[error] Class Drupal\entityqueue\Routing\RouteSubscriber does not existComment #35
millionleaves commentedI just tried #32 again on two separate 8.4.4 codebases. The patch applied OK, and added an Entityqueue tab to those node types that can be added to an entityqueue.
In relation to #33, I also tried creating, then deleting, a test entityqueue that related to just one of my node types. When I deleted it, I got a website error:
Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "Some mandatory parameters are missing ("entity") to generate a URL for route "entity.entity_subqueue.add_item"." at /var/www/html/path-to/drupal/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 753, referer: https://www.mysite.com/admin/structure/entityqueue/test_queue/deleteWhen I went to the edit page for a node, I could make changes but clicking on the Entityqueue tab gave me this error:
PHP Fatal error: Call to a member function getEntitySettings() on null in /var/www/html/path-to/drupal/modules/contrib/entityqueue/src/Controller/EntityQueueUIController.php on line 87, referer: https://www.mysite.com/node/57/edit?destination=/admin/contentThis was the case for the single node type I'd linked to the test entityqueue, plus other node types that were linked to other entityqueues.
I resolved it by manually removing my test entityqueue from the entity_subqueue table, and the single node link I'd created to that entityqueue from the entity_subqueue__items table. Once I did that, I was able to click the Entityqueue tab on a node and see the available queues, as expected.
I haven't tested an unpatched version of the Entityqueue module to see if this problem with deleting a queue was already happening, but I'm not sure how this patch would have caused this error to start happening.
Comment #36
amateescu commentedThe patch needed quite some work to get in a proper state, but I'm pretty happy with how it turned out. Thanks @josebc and @RajabNatshah!
The problem outlined in #35 was easy to fix, we can simply take out the new link relationships from the entity subqueue definition, as they are pretty useless there anyway :)
Edit: and I couldn't reproduce #33, maybe that was also fixed with some of the refactoring that I made.
Comment #37
amateescu commentedComment #39
amateescu commentedCommitted to 8.x-1.x. Thanks everyone!
Comment #40
dwwSweet, thanks for all the work here, everyone!
One question: it seems very common that if you're on the 'Entityqueue' tab on a given entity, in addition to the 'add to queue' or 'remove from queue' operation, a content editor/admin would want/need to be able to 'Edit queue items' to change the order, etc. Should I open a follow-up issue about this or is there interest in another patch in here for it?
Thanks again!
-Derek
Comment #41
millionleaves commented@dww I think we definitely need the option for Edit queue items, but I think you should start another issue, given that this one is already fixed and committed.
Comment #42
dwwFair enough. Opened #2947820: Add 'Edit queue items' operation to new entityqueue tab on entities as a child issue.
Let's continue the discussion there.
Thanks,
-Derek