1

I am using Views Navigation module. I have created a list of articles using views and selected "Add navigation links on node pages accessed from this view" under "Views Navigation" in Advanced. The views navigation is working fine and I can go back and forth in the views list of articles.

Now if I edit the node (while viewing a views navigation list) and submit the edited node, I was returned back to the node page without the "views navigation" links appended to the URL. Hence I cannot move back forth in the list (the list is gone; it behaves like a simple node view).

The scenario is that this views navigation list will be used by editors and moderators who may edit an article while viewing the list so they should be redirected back to this list once they edit an article.

One of the solution I am thinking is to alter node edit link using hook_menu_alter(). Is there any non-programmatic way of doing this? I have tried Rules and captured the appended URL parameters but I don't know how to alter a node edit link. Can someone please point me in the right direction?

Many Thanks

1 Answer 1

0

I found a solution, through code unfortunately, using hook_url_outbound_alter().

For anyone trying this, I have implemented the following code and it is running perfectly:

function mymodule_url_outbound_alter(&$path, &$options, $original_path) {
// get current position and list token
$position = isset($_GET['position']) ? $_GET['position'] : NULL;
$list = isset($_GET['list']) ? $_GET['list'] : NULL;

// only when viewing nodes through views navigation
if ( $position && $list && preg_match('|^node/([0-9]*)/edit(/.*)?|', $path, $matches)) {
    $path = 'node/'.$matches[1].'/edit';
    $options['query']['destination'] = 'node/' . $matches[1] . '?position=' . $position. '&list=' .$list;
    }
}

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.