2

In my Search API view, I'd like an Exposed filter > Entity reference to be a select box, not a text field.

Details

I have a view which I created like:

  • Views > Add new view > Show: default node index

So it uses the Search API index as a basis.

In the Search API I have ticked to index field_entity which is an Entity reference > Content_type: entity (confusing naming, I know).

I want the user to go to the views page & be able to filter the view results by field_entity (which is an exposed filter/entity reference).

The issue is the view shows the exposed filter as a text field. I have edited field_entity & checked the box Render Views filters as select list - this works fine for a normal view but not for a Search API view.

Question

Can I somehow convert this text field to a select box?


To clarify, I cannot use custom or contributed modules on this project, so it needs to be done without using hooks, or other modules, etc.

Drupal 7, Search API Views

  • I assume Drupal 7? Have you looked at better exposed filters module? – longboardnode Jan 20 '17 at 6:08
  • Yes D7, sorry should have also mentioned we can't install contrib modules! Weird project I know, long story. Thanks though, will update original question. – 100pic Jan 22 '17 at 11:38
  • Oh ok sorry missed that in your OP. Can you use custom logic in Views templates? – longboardnode Jan 23 '17 at 5:02
  • Yes! I think we can, since we can edit the theme layer. We also have access to a few pre-installed contrib modules, such as display suite / DS extras, but we can't install new contrib modules. No better exposed filters unfortunately :( – 100pic Jan 23 '17 at 5:35
  • sorry for delayed response. you should be able to fix that field with some logic in views_pre_render would that work within your parameters? – longboardnode Feb 3 '17 at 17:29
0

Try to use TYPE => String. This work for me. enter image description here

  • Thank you for the answer. It would be better, especially for non-sighted users, if your answer could be a bit more descriptive than just including the image. It also helps to save the information if the image were to be come unavailable. – mradcliffe Jul 18 '18 at 13:34

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.