[SOLVED][Drupal Views] Edit link destination incorrect when using AJAX-enabled views

| | 1 min read

A few Drupal users have encountered a situation where after they had created a View that returns nodes in a Grid format, the edit link field (?destination=views/ajax) they had added was redirecting them to a page containing JSON instead of the actual edit page. If you are encountering the same situation in your Drupal site then read on to find out the fix.

The following patch has been widely reported to fix the issue.

// Overwrite the destination.
// @see drupal_get_destination()
$origin_destination = $path;
$query = $_REQUEST;
$query_string = drupal_http_build_query($query);
if ($query_string != '') {
  $origin_destination .= '?' . $query_string;
$destination = &drupal_static('drupal_get_destination');
$destination = array('destination' => $origin_destination);

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.