I need a snippet to place in the template.php that will add some first and last classes to the respective local task tabs.

I've got 10 dollars for this.

Comments

askibinski’s picture

Old post, but stumbled upon it while searching for a solution. Might help other people. (keep the ten bucks ;)

This works for Drupal 7:


/*
* this function processes your $tabs and should be called from preprocess_page in your template.php
*/
function YOURTHEMENAME_process_tabs(&$vars) {
  $types = array('#primary', '#secondary');
  foreach ($types as $type) {
    if (is_array($vars['tabs'][$type])) {
      foreach ($vars['tabs'][$type] as $key => $tab) {
        $vars['tabs'][$type][$key]['#link']['localized_options']['attributes']['class'][] = drupal_clean_css_identifier($vars['tabs'][$type][$key]['#link']['path']);
      }
    }
  }
}

Albert Skibinski - Homepage