pdaleramirez / super-filter

Other
6 stars 2 forks source link

Entry types rather than entire sections #19

Closed jeffaglenn closed 3 years ago

jeffaglenn commented 3 years ago

Is there a way that craft.superFilter.setup('handle') can take an entry type rather than the entire section?

pdaleramirez commented 3 years ago

@jeffaglenn Are you trying to show the fields in the front end based on entry type? Fields are shown based on what you drag to the selected box in the search fields section in super-filter CP. Not sure what's your use case,

jeffaglenn commented 3 years ago

Sorry, should have added a little more context.

I have a section that I'm using with SuperFilter and it's working great. I now need to add another entry type to that section however I don't want the new entry type to be included in the filterable content.

So my use case is: I had a section called Homes for Sale. I am able to filter by bedroom, bathroom, etc. Now the client wants to add another type of home that's for sale (to be used elsewhere) but they don't want this new type to show up in the filtered results at all. Instead of creating a new section I was just going to create a new entry type within the existing section. If I can't specify a type within a section then I can just create a new section.

pdaleramirez commented 3 years ago

@jeffaglenn There is no EVENT or an argument to pass on the twig method to specify which Entry Type you want to be displayed yet. I will take a note on this and add this feature on future releases.

There is a workaround with this you can use the {{ craft.superFilter.getSearchField('fieldHandle') }} twig method to specify individual field you want to display. In your case you make a if condition if you are on the correct entry type and only show those individual fields. I hope that makes sense.

jeffaglenn commented 3 years ago

Ah, gotcha. Thanks for the quick response!