1

Third day I'm looking for a solution, but I can not find an answer. I use Taxonomy term as a filter (Better Exposed Filters) on Views. To Taxonomy term added a field image. How programmatically display the Image field before Taxonomy name in Better Exposed Filters? Taxonomy name

I tried modules taxonomy_icon, vocabulary image, taxonomy image All of them do not provide an opportunity for filters Views to derive taxonomy terms in the form of "image taxonomy name".

2
  • Is your goal to replace the checkbox with an image and toggle that between an checked/unchecked version of an image?
    – devunder
    Mar 10, 2017 at 21:30
  • @undersound Thank you for respond. The goal to display taxonomy image between checkbox and taxonomy name.
    – makbuk
    Mar 11, 2017 at 6:37

1 Answer 1

1

I was prompted how to do it. Thanks a lot to xandeadx.

function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state) {

foreach ($form['TAXONOMY_ELEMENT']['#options'] as $tid => &$name) {
    $term = taxonomy_term_load($tid);
    $name = '<img src="' . file_create_url($term->FIELD_IMAGE['und'][0]['uri']) . '" />' . $name;
  }
}

In my version TAXONOMY_ELEMENT = tid_1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.