Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In EntityListBuilder::getDefaultOperations action links point to various forms like edit and delete. Since this is a list of entities I think user should return to it after he performs the action instead to the entity view page.
This code: https://api.drupal.org/api/drupal/core%21modules%21node%21src%21NodeList... shows an example of how to add a destination.
Comment | File | Size | Author |
---|---|---|---|
#9 | add_default_destination-2165585-9.patch | 3.04 KB | Darren Oh |
Comments
Comment #1
mikedotexe CreditAttribution: mikedotexe as a volunteer commentedComment #2
serundeputy CreditAttribution: serundeputy at Common Media for Backdrop CMS commentedThe function `getDefaultOperations` is overridden on the `admin/content` view and on that override they have a `destination` https://api.drupal.org/api/drupal/core%21modules%21node%21src%21NodeList...
So, it is determined that this is a good idea we can implement similar $destination in this function.
Comment #3
serundeputy CreditAttribution: serundeputy at Common Media for Backdrop CMS commentedComment #4
serundeputy CreditAttribution: serundeputy at Common Media for Backdrop CMS commentedchanging to `8.2.x` to reflect current code state.
Comment #5
Darren OhComment #6
Darren OhSetting priority to minor because this can easily be overridden.
Comment #7
Darren OhComment #9
Darren OhComment #11
codexmas CreditAttribution: codexmas at Acquia commentedHaving just encountered an issue with destinations being stripped and a lot of debugging, I think adding the 'query' info directly to the operation isn't the right way.
The correct way is to use the Url->setOption('query', $destination) method instead.
Given that $destination is an array of ['destination'] => '/some/path'
Perhaps the 'query' part of the operation is a remnant of render arrays?
Comment #16
alexpottThis is a duplicate of #2767857: Add destination to edit, delete, enable, disable links in entity list builders - well this was a duplicate of that but it got committed so...