I use THEME_select_as_links to display my exposed block in taxonomy/term/% view.
I want to add class 'selected' to my exposed field option.
I add this code to my theme template.php

function THEME_select_as_links($vars) {
  $tid = menu_get_object('views_arg', 2);
  $element = &$vars['element'];
  if (isset($element['#options']) && isset($element['#options'][$tid])) {
    $element['#value'][$tid] = $tid;
  }
  dpm($vars);
  return theme_select_as_links($vars);
}

After it - nothing changed.
I've found that, that $selected_options may contain array(), because of this code

  else {
    $selected_options[] = $element['#value'];
  }

That's why only items from$urllist['query'] may have class 'selected'.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nikolay Shapovalov’s picture

Status: Active » Needs review
FileSize
995 bytes

This patch merge arrays $selected_options with $element['#default_values'] or $element['#value'].
It convert multidimensional array to simple list array.
Works for me.

Neslee Canil Pinto’s picture

Status: Needs review » Closed (won't fix)

Hi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).