Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // Set to the current path so we can redirect back there after submit.
  2. $form['submission_path'] = array(
  3. '#type' => 'hidden',
  4. '#default_value' => current_path(),
  5. '#weight' => -100,
  6. );
  7.  
  8. $form['#action'] = url('search-callback');
  9.  
  10. function mymodule_search_callback() {
  11. return '';
  12. }
  13.  
  14. // Redirect back to the page that submitted the search.
  15. $form_state['redirect'] = array(
  16. $form_state['values']['submission_path'],
  17. array(
  18. 'query' => array(
  19. 'search' => urlencode($search-term),
  20. ),
  21. ),
  22. );
  23.  
  24. $form['#submit'][] = 'mymodule_search_callback'
  25.  
  26. function mymodule_search_callback() {
  27. $form_state['redirect'] = current_path() . and your urlencoded serch term;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement