2

Okay, so I have been searching Google for weeks on how to do this, and I have kludged some stuff together.

I want to combine a dropdown for year values, and combine it with a search box.

Now, I've figured out that I can create a view, and then pass contextual arguments through the URL. That works perfectly. I can get results for brakes manufactured for cars in 1977 by visiting the URL http://example.com/cars/1977,brakes.

I am trying to configure the interface that will pass the query now. I can do this by passing to a php function outside of Drupal core or related modules. As much as possible, I would like to keep this within the Drupal 7 interface.

My best guess now is using hook_form_alter to alter the url before it is passed. I am also guessing it would have to register a state change and grab the fully built url before passing it. Sorry if I am rambling here.

Has anyone ever built anything like this in D7? I know there was a module in D6 that did something close to this, but it has not been ported to D7. Any help would be much appreciated, with links to either tuts, or code examples.

Gracias.

3
  • what module in D6 did almost what you wanted?
    – Jimajamma
    Jan 3, 2012 at 6:34
  • To answer your question, I don't remember. I've been through a ton of modules lately, and I can't remember (or find the thing in Google) to save my life. This comment has a link to an Acquia tutorial that has a search box. drupal.org/node/345942#comment-2132898 , but it still doesn't help with a menu. Jan 3, 2012 at 14:47
  • Okay, since nobody answered my question, I ended up doing this with PHP. Quoting from earlier: I've figured out that I can create a view, and then pass contextual arguments through the URL. That works perfectly. I can get results for brakes manufactured for cars in 1977 by visiting the URL example.com/cars/1977,brakes. End quote. What I did was make a standard dropdown, combine it with a text box, pass the variables, and then use header(Location:) to redirect to the appropriate url w/vars. Since nobody else on the internet seems to know how, I guess my little workaround will do. Jan 4, 2012 at 0:35

0

Your Answer

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

Browse other questions tagged or ask your own question.