Code Snippets

How to fix Hard-coded arguments for quicktab views

Regarding this problem, you'll have to apply the patch filed against this issue before implementing this hook. More information about this topic can be found here.

/**
 * Implementation of hook_quicktabs_alter().
 */
function mymodule_quicktabs_alter(&$quicktab, $op) {
	if ($quicktab->machine_name == 'my_block' && $op == 'view') {
    // Some code to set default tab ($default_tab_key)
    // and an array of arguments for each tab ($date_args)
    
    // Set default tab and date args for all tabs.
    $quicktab->default_tab = $default_tab_key;
    foreach ($quicktab->tabs as $key => $quicktab) {
      $quicktab->tabs[$key]['args'] = $date_args[$quicktab['title']];
    }
  }
}
Resource Tags: