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.
I don't know if this is a commerce, views, or core (likely) problem, but with current Drupal 7 and a clean commerce install, you can't actually edit a cart view on /cart, for example, using contextual links. You can use the gear icon and select "edit view", but nothing happens.
Comment | File | Size | Author |
---|---|---|---|
#7 | 1343888-remove-redirect.patch | 2.55 KB | dawehner |
#6 | 1343888-6.contextual_edit_redirect.patch | 892 bytes | rszrama |
#3 | 1343888.contextual_edit_redirect.patch | 963 bytes | rszrama |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedSomething appears to have changed inside of Views itself. Updating to the new rc, I get the same problem, and I've traced it to the fact that those Views don't have other displays besides the default display that we've been manually embedding in the block / page. I was hoping to put off that conversion, but we may have to go for it. For now, let's make this a Views support request.
The issue here is that the contextual link normally is to the following URL:
/commerce/admin/structure/views/view/commerce_cart_block/edit/default?destination=node
Because there is only the default display, Views appears to institute an automatic redirect to the following URL:
/commerce/admin/structure/views/view/commerce_cart_block/edit?destination=node
Unfortunately, when the redirect happens, it's picking up on the destination query string and sending you back to the page you were on. ; )
So the question in the Views queue is: can we get around this behavior without having to fix [#] before our 1.1 release?
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedThe code that does that redirect *should* in theory be able to unset $_GET['destination'] (as long as preserves the destination in the new URL) to ensure drupal_goto() doesn't choke on it.
Care to attempt a patch? It should be a one or two liner.
Comment #3
rszrama CreditAttribution: rszrama commentedPatch attached. Think it's sufficient to just grab
destination
out of the $_GET?Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedI took a quick look at drupal_get_destination()
It includes this code I hadn't realized was there when I wrote the above:
Therefore we need to clear that static just to be safe.
It may be best to actually use drupal_get_destination() then unset both $_GET['q'] and the static.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedOh, in checking drupal_goto we do NOT need to unset this static.
We should still use drupal_get_destination to prepare the field, though.
Comment #6
rszrama CreditAttribution: rszrama commentedDouble checked and because of the way drupal_goto() works, we do still need to
unset($_GET['destination'])
.Comment #7
dawehnerI think the proper way of doing it is to remove the drupal_goto and allow to get the default display directly via the url.
This patch allows to go to the default display, even if it's hidden via the setting, but hide the tab if the setting is enabled.
The only problem is that the access is coupled to the logic of generating the list of displays.
Feel free to comment which idea is better.
Comment #8
ñull CreditAttribution: ñull commentedPatch in #7 was tested and worked here. Cannot comment on the better solution, so I leave alone the status.
Comment #9
awolfey CreditAttribution: awolfey commented#7 works and looks good to me. Thanks.
Comment #10
dawehnerThanks for testing the patch! Committed to 7.x-3.x after a short review.