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.
File: better_exposed_filters.theme
Line: 446
_form_set_class($elem, array('bef-select-as-links-selected'));
The _form_set_class set the class in the #attributes but the class is not printed in the HTML when on the same page of the link, So no way to custom style the selected page link.
Comments
Comment #1
Barry Tielkes CreditAttribution: Barry Tielkes commentedI ran in to the same problem. And found a simple solution:
$elem = array(
'#tag' => 'div',
'#id' => $id,
'#value' => $value,
'#markup' => '',
'#attributes' => array('class' => array('form-item', 'bef-select-as-links-selected')),
);
$output .= theme('html_tag', array('element' => $elem));
Use 'theme_html_tag' instead of 'theme_form_element'.
'theme_form_element' does not allow to add classes.
Comment #2
gomino CreditAttribution: gomino commentedI commented this:
And I added your code, but it still does not work.
EDIT:
Sorry, it works now, but not in the beginning when none of the links are clicked. That is why I thought it did not work.
I then clicked on the links and it worked.
Thanks!
Comment #3
mikeker CreditAttribution: mikeker commentedIssue queue cleanup... My apologies for taking so long to address this issue!
Based on the above comments (thank you @Barry Tielkes for posting your workaround!) I'm closing this issue. There is a Drupal core issue about how theme_form_element doesn't allow classes somewhere in the queue, but I've lost track of it... (Edit: found it: #1114398: Form element & Form element label theming is broken)
Thanks!