Using D7, I have a view with BEF that uses checkboxes for filtering by a taxonomy term. Everything works as intended, but I want to customize the checkboxes in a very special way, and don't have a clue how to acieve this: I want to replace the checkboxes with images and use these in a "toggle" style. These images should not be all the same. The taxonomy terms (that these checkboxes represent) have a field_icon with an image, and I want that image to be displayed instead of the checkbox.

  • The normal checkbox image replacement per css does not work for me because there it is only possible to use the same one image for all checkboxes. This is not what I want, as I need different images.
  • The method using views-exposed-form----.tpl cannot be used because it only exposes print $widget->widget, and this 2idget cannot be themed in a more fine grained way there.

The only thing I could think of is the function theme_select_as_checkboxes($vars) in /sites/all/modules/better_exposed_filters/ which defines the html output for the exposed filters checkboxes. But as I don't have much experience with php (I understand it and would be able to write some code with some help), and even less experience with drupal api/coding I don't really know what to do here.

Could anyone give me some advice please? What would be an ideal solution: In the view -> advanced -> BEF settings you can select at "Display exposed filter as:" 4 different "formatter" types: standard, checkboxes, links, hidden I would like to have another one like "images", ideally with the possibliity to select the image field of that taxonomy field (I know, these checkboxes must not be rendered from taxonomy... but anyway) If not, I would just create a module (or place it into my theme?), overwrite the theme_select_as_checkboxes function and replace the default checkboxes with image checkboxes, fetching the images from the taxonomy term field, hard coded.

But this is only my vague idea of how this could be achieved - I really don't know how exactly to do that - e.g. how to access taxonomy fields from within the theme_select_as_checkboxes function...

Any help welcome, thanks.

  • I would just use a jQuery plugin for this. Or see this post on how to do it manually. – Felix Eve Apr 17 '14 at 13:46
  • This is what I described as I don't want. It's the same (please correct me if I'm wrong) as the css version. It replaces ALL checkboxes with the same image. I want different images according to the taxonomy term behind it. – nerdoc Apr 17 '14 at 15:37
  • Just target those specific ones with css selectors. – Felix Eve Apr 17 '14 at 16:00
  • And how do I get the source (URL) of that specific images? – nerdoc Apr 17 '14 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.