I have created view in that view I exposed sorting with dropdown field 'Distance', 'Rating', 'Review', it works fine. Now I want to convert that dropdown into checkboxes with AJAX callback. I used module Better Exposed Filters please suggest me to how to do that.
2 Answers
You can achieve this goal by Implementing hook_form_alter
e.g:
/**
* Implements hook_form_alter().
*/
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'test' && $form_state['view']->current_display == 'page_1') {
// do your alteration stuff
$form['sort_order']['#type'] = 'radios';
//$form['sort_by']['#type'] = 'radios';
}else
if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'test' && $form_state['view']->current_display == 'page_2') {
// do your alteration stuff
}
}
-
Yes its working for me. Now I am trying to get that radios into checkboxes. for that I have to enable multi selection on sorting after that I will get checkboxes. thanks for ur efforts. Jan 16, 2015 at 9:34
-
Hi @Kailash if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this.– RupeshJan 16, 2015 at 9:49
I Suppose this may help you using Better Exposed Filters
-
Thanks for your timely response. But as I mentioned above I am searching for "SORTING" and not a filtering. Jan 16, 2015 at 7:20