Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /**
  2. * Implements hook_views_pre_execute().
  3. */
  4. function MODULENAME_views_pre_execute(&$view) {
  5. // Set the first contextual filter value.
  6. $view->args[0] = 1;
  7. }
  8.  
  9. /**
  10. * Implements hook_views_pre_execute().
  11. */
  12. function mymodule_views_pre_view(&$view, &$display_id, &$args) {
  13. if ($view->name == 'VIEWNAME' && $view->current_display == 'DISPLAYNAME') {
  14. $url = arg();
  15. if (isset($url[1])) {
  16. // YOU MIGHT HAVE TO ADJUST $url[1] TO MATCH YOUR URL ALIAS.
  17. if ($normal_path = drupal_get_normal_path($url[1])) {
  18. $path_args = explode('/', $normal_path);
  19. }
  20. }
  21. if (isset($path_args[1])) {
  22. $view->args[0] = $path_args[1];
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement