0

I am trying to create a filter condition for entity reference field in views, i tried by using rendered entity option it is showing dropdown for filter condition. I need autocomplete or it should be without dropdown and autocomplete (plain filter field).

It should apply after giving full value in filtercondition?

Any suggestions..

/* Filter criterion: Content: Cage ID_VBC (field_cage_id_vbc) */
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['id'] = 'field_cage_id_vbc_target_id';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['table'] = 'field_data_field_cage_id_vbc';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['field'] = 'field_cage_id_vbc_target_id';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['group'] = 1;
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['expose']['operator_id'] = 'field_cage_id_vbc_target_id_op';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['expose']['label'] = 'Cage ID';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['expose']['operator'] = 'field_cage_id_vbc_target_id_op';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['expose']['identifier'] = 'field_cage_id_vbc_target_id';
$handler->display->display_options['filters']['field_cage_id_vbc_target_id']['expose']['remember_roles'] = array(
  • @ No Sssweat - Hi are you there? – DINE Oct 19 '15 at 11:28
1

you can change an exposed filter to Select List or Text Box using the following code..

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form') {
    $view = $form_state['view'];
    if ($view->name == 'my_view_machine_name' && $view->current_display == 'display_name') {
        $options = array('your options');
        $form['your field name']['#type'] ='select'; //Use TEXTBOX for text field.
        $form['your field name']['#size'] = null;
        $form['your field name']['#default_value'] = '';
        $form['your field name']['#options'] = $options; //not needed for textbox
    }
  }
}

Another option is use Autocomplete Deluxe for References Module.

Hope this will help you..

  • @ Abin - thanks for your response ...where should i change this code? – DINE Oct 19 '15 at 8:01
  • write it in custom module and replace "mymodule" with your module name and also view name and field name with your view name and field name. – Abin Oct 19 '15 at 8:22
  • @ Abin - In above i have posted my filter code in that place can i change any thing? – DINE Oct 19 '15 at 8:25
  • if you want change field_cage_id_vbc_target_id filter.. then replace field name with that in code. – Abin Oct 19 '15 at 8:29
  • @ Abin - in the place field_cage_id_vbc_target_id ...your code i want to put? – DINE Oct 19 '15 at 8:31

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.