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

  • Is your goal to replace the checkbox with an image and toggle that between an checked/unchecked version of an image? – undersound Mar 10 '17 at 21:30
  • @undersound Thank you for respond. The goal to display taxonomy image between checkbox and taxonomy name. – makbuk Mar 11 '17 at 6:37
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, privacy policy and cookie policy

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