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

Barry Tielkes’s picture

I 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.

gomino’s picture

I commented this:

$elem = array(
          '#id' => $id,
          '#children' => $value,
          '#markup' => ''
        );
        _form_set_class($elem, array('bef-select-as-links-selected'));
        $output .= theme('form_element', array('element' => $elem));

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!

mikeker’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Issue 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!