Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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'.
Comment | File | Size | Author |
---|---|---|---|
#1 | better_exposed_filters-selected_options_to_list-2206131-1.patch | 995 bytes | Nikolay Shapovalov |
Comments
Comment #1
Nikolay ShapovalovThis patch merge arrays $selected_options with $element['#default_values'] or $element['#value'].
It convert multidimensional array to simple list array.
Works for me.
Comment #2
Neslee Canil PintoHi, 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).