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.

Comments

Xenza’s picture

Version: » 7.x-1.0-alpha3
FileSize
3.04 KB

Hi,

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.

joachim’s picture

Version: 7.x-1.0-alpha3 » 8.x-1.x-dev
Priority: Normal » Major

Bumping the version & upping to major. Now that this module is replacing nodequeue for D8, this is sort of a regression in the UX...

josebc’s picture

Assigned: Unassigned » josebc
josebc’s picture

Status: Active » Needs review
FileSize
15.09 KB

Code is a little dirty but good for a start

RajabNatshah’s picture

+1 Testing :)

RajabNatshah’s picture

Passed
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

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
As a logged in user with a permission to manage entity queues
I well be able to see an Entityqueue tab inside the full content page of a selected content
So that I can Add to queue or Remove from queue for the content.

@javascript @local @development
Scenario: Check if queuable content have the "Entityqueue" tab at the full content page and can Add to queue or Remove from queue.
  Given I am a logged in user with the "webmaster" user
   When I go to "/node/add/test_content"
    And I wait
   Then I should see "Create Test Content"
   When I fill in "Test tab content number 1" for "Title"
    And I fill in the rich text editor field "Body" with "Test tab content number 1 Body"
    And I press "Save"
    And I wait
   Then I should see "Test Content Test tab content number 1 has been created."
    And I should see "Entityqueue"
   When I click "Entityqueue"
    And I wait
   Then I should see "Add to queue"
   When I click "Add to queue"
    And I wait for AJAX to finish
   Then I should see "Remove from queue"
   When I click "Remove from queue"
    And I wait for AJAX to finish
   Then I should see "Add to queue"
RajabNatshah’s picture

Status: Needs review » Reviewed & tested by the community
RajabNatshah’s picture

Assigned: josebc » Unassigned
Status: Reviewed & tested by the community » Needs work

I have one issue for this patch.
The Entityqueue Tab will show up for content types which are not selected in any eneity queue

josebc’s picture

Status: Needs work » Needs review
FileSize
16.87 KB

new patch with condition

RajabNatshah’s picture

Testing .......

RajabNatshah’s picture

RajabNatshah’s picture

Status: Needs review » Reviewed & tested by the community
amateescu’s picture

Status: Reviewed & tested by the community » Needs work

As @josebc mentioned in #4, the code does look kinda dirty to me as well :)

Here's a small review for now:

  1. +++ b/entityqueue.routing.yml
    @@ -63,3 +63,21 @@ entity.entity_subqueue.add_form:
    +entity.entity_subqueue.add:
    +  path: '/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}/{entity}/add'
    ...
    +entity.entity_subqueue.remove:
    +  path: '/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}/{entity}/remove'
    
    +++ b/src/Entity/EntitySubqueue.php
    @@ -49,7 +49,9 @@ use Drupal\user\UserInterface;
    + *     "add" = "/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}/{entity}/add",
    + *     "remove" = "/admin/structure/entityqueue/{entity_queue}/{entity_subqueue}/{entity}/remove"
    
    @@ -277,6 +279,28 @@ class EntitySubqueue extends ContentEntityBase implements EntitySubqueueInterfac
    +  public function add($entity_id) {
    ...
    +  public function remove($entity_id) {
    

    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.

  2. +++ b/src/Controller/EntityQueueEntityController.php
    @@ -0,0 +1,142 @@
    +class EntityQueueEntityController extends ControllerBase {
    

    All methods from this controller could actually move to the existing \Drupal\entityqueue\Controller\EntityQueueUIController class.

  3. +++ b/src/Controller/EntityQueueEntityController.php
    @@ -0,0 +1,142 @@
    +              'url' => $subqueue->urlInfo('remove'),
    ...
    +              'url' => $subqueue->urlInfo('add'),
    
    +++ b/src/Entity/EntitySubqueue.php
    @@ -309,7 +333,12 @@ class EntitySubqueue extends ContentEntityBase implements EntitySubqueueInterfac
    +    if (in_array($rel, ['add', 'remove'])) {
    +      $route_match = \Drupal::routeMatch();
    +      $entity_type = $route_match->getParameter('entity_type_id');
    +      $entity = $route_match->getParameter($entity_type);
    +      $url->setRouteParameter('entity', $entity->id());
    +    }
    

    Instead of the hackish code in \Drupal\entityqueue\Entity\EntitySubqueue::toUrl(), why don't we add the parameter directly where we need it?

  4. +++ b/src/Controller/EntityQueueEntityController.php
    @@ -0,0 +1,142 @@
    +    //TODO: change to replace command instead of reload.
    

    Needs to be done, I think?

  5. +++ b/src/Controller/EntityQueueEntityController.php
    @@ -0,0 +1,142 @@
    +    $lol = $entity;
    

    :)

  6. +++ b/src/Controller/EntityQueueEntityController.php
    @@ -0,0 +1,142 @@
    +        return AccessResult::allowedIf(TRUE);
    ...
    +    return AccessResult::allowedIf(FALSE);
    

    This can just be ::allowed() and ::forbidden().

  7. +++ b/src/Plugin/Derivative/EntityqueueLocalTask.php
    @@ -0,0 +1,76 @@
    +          'weight' => 999,
    

    Do we really need this weight so high? If yes, I'm very curious why :)

josebc’s picture

amateescu 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

RajabNatshah’s picture

Grate work!!!

My only wish will be if we could have a custom label for the tab.

amateescu’s picture

@josebc, D8 noob or not, you're doing a very good job :)

josebc’s picture

Status: Needs work » Needs review
FileSize
17.03 KB

new patch with review feedback and some cleanup

amateescu’s picture

Can you please provide an interdiff so it's easier for a reviewer to see exactly what changed from the previous patch?

josebc’s picture

FileSize
17.64 KB

interdiff

RajabNatshah’s picture

Testing .....

RajabNatshah’s picture

Status: Needs review » Needs work

- Not up to date with the latest DEV.
- ( Suggestion )

No custom label caption. "Entityqueue" is not User friendly, this should be added for each content type, something like "Featured", "Add to featured", "Top Order", "Add to Order", "Add to the stack", "Queue", "Queues", or "Stack".
josebc’s picture

Status: Needs work » Needs review
FileSize
16.91 KB

Reroll for latest dev

RajabNatshah’s picture

Testing ....

RajabNatshah’s picture