Drupal Kludge 1: Views & Return Links

The Future Will Be Kludged by purpleslog

Sometimes, I'm a dope.  Actually, a lot more often than sometimes, but who's counting, right?  Well, found myself searching around the other day for a solution to a challenge with a drupal site, and no matter what I searched for, I wasn't finding the answer to what I wanted. 

I have been trying to streamline the workflow on a particular utility site.  One of the things I've been trying to do, on a particular view, is provide a link that will send a user to a node creation form (I'm using the Prepopulate module to fill in fields in the node creation form based on which link in the view the user clicks), but when the node is completed, I want to bring them back to the view, rather than the default behavior (view the completed node).  

I looked at some of the actions and rules solutions that are out there, but they all seemed so heavy handed.  I wanted a simple solution, but I couldn't find anything on the Drupal.org site that spelled it all out for me.  

So, I poked around, found a link that was using the "destination" attribute, and decided to give it a try -- and it worked! 

So, the lightweight solution to my problem works like this: in the view, select the field that contains the link to the node creation form.  I checked the "rewrite the output of this field" and there, using the tokens provided, I reconstructed the link to the node creation form.  This time, however, I added the "&destination=" and the relative url ("node/123" or whatever) of the page I wanted the user to land on after creating their node.  

If you're trying this yourself, if your URL does not contain other specified URL variables the way mine did (for the "prepopulate" module" you'll want to use a "?" instead of the "&" in the url. 

I'm sure there are other, better ways to do what I did -- I know that I could do this with a complex set of rules and actions, for example.  But this seems like a much simpler way to get the job done.  

 

Picture by Purpleslog @ Flickr

Hi!   Thanks for the great

Hi!

 

Thanks for the great tips! Do you know how this is possible in Drupal 7? The URLs seem to be different, so I can get it working. 

 

Navigation

User login

Connect
Sign in using Facebook

Syndicate

Syndicate content
Powered by Drupal, an open source content management system