Fix for view arguments exposed links

  1. /**
  2.  * Implementation of hook_views_pre_render.
  3.  */
  4. function views_arg_list_views_pre_render(&$view) {
  5.  
  6.   // check this is calendar view, showing a page
  7.   if ($view->name == 'calendar_combined' && $view->current_display == 'calendar_1') {
  8.     //dsm($view->display['calendar_1']->display_options['path']);
  9.  
  10.     $path = $view->get_path();
  11.     //dsm($path);
  12.     //dsm($view);
  13.  
  14.     // Vocab id
  15.     $vid = 6;
  16.  
  17.     // Current args: just the calendar arg
  18.     $arg = $view->args[0];
  19.     $path .= '/' . $arg;
  20.    
  21.     $links[] = array(
  22.         'title' => 'All',
  23.         'href'  => $path . '/all',
  24.       );
  25.     $tree = taxonomy_get_tree($vid);
  26.     foreach ($tree as $term) {
  27.       $link = array(
  28.         'title' => $term->name,
  29.         'href'  => $path . '/' . str_replace(' ', '-', strtolower($term->name)),
  30.       );
  31.       $links[] = $link;
  32.     }
  33.  
  34.     $output = theme('links', $links, $attributes = array('class' => 'links'));
  35.  
  36.     $view->attachment_before = $output;
  37.  
  38.   }
  39.  
  40.   return;
  41. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.