Nomistake
Nomistake

Reputation: 863

Exposed views filter made of titles

I'm making a views slideshow of some images. These images have a title. I would like to expose this title as a drop-down list filter.

I'm able to do this with pr-configured filter values, but i want this list to be build by the values that the end users gives as a title to a image. (or made of another field like description etc...)

So, when a user uploads images with a title "vacation", i would like this value to come up in the exposed filter in the views slideshow...

Thank you

Upvotes: 1

Views: 2263

Answers (2)

iamfredrik
iamfredrik

Reputation: 340

This can easily be done using the Views Reference Filter module.

  1. Create a views page with the fields you wish to display.

  2. Add an Entity Reference display to your view.

  3. Set which field should act as your search field in the format settings of the Entity Reference display (in this case Content: Title). Remove or exclude all other fields for this display only (override).

  4. To your page display add a filter Content: Nid (entityreference filter) and expose it to visitors. Remember to select the correct view in the "View used to select the entities" drop down if you have more than one Entity Reference views.

Optional steps:

  1. Enable Ajax for your view.

  2. Set the exposed form style setting to auto submit.

Upvotes: 4

benashby
benashby

Reputation: 468

If I were trying to accomplish this I would add a taxonomy vocabulary for these images, then I would add a field to the image content type referencing this vocabulary.

After that, I would use create a Rule that would react to saving a new image and add a new taxonomy term to that image that is the title entered.

You can then easily create a filter in views to filter off that taxonomy term and expose that as a dropdown. By doing this each image should have a taxonomy term attached to it that is the image's title. As images are added the taxonomy terms should appear in the dropdown.

Let me know if you need any additional guidance.

Upvotes: 1

Related Questions