Collection Search

I am modifying my collections/show file to incorporate search functionality for each collection, which I have working fine for keyword search. However, I'd like to include the ability to "Narrow by Specific Fields" in the same manner that the Advanced Search functions, but only displaying in the dropdown menu the fields that are included within that collection, or alternatively only fields within a specific item type, rather all possible fields.

It looks like the following code generates the dropdown menu :

get_table_options('Element', null, array('record_types' =? array('Item', 'All'), 'sort' => 'orderBySet')

How can I modify this to only include the relevant fields for the collection? Any suggestions or guidance would be appreciated.


It looks like one of the existing filters that might get close to what you need is a filter by the item type id. Changing the array in the third argument to something like:

array('item_type' => 3, 'sort' => 'orderBySet'));

will get you just the elements from item type with id 3, for example.

There's not really a good filter for something like elements used by items in a collection.

Thanks! This will work perfectly as long as I only use Item Type metadata fields for the content that I want to search, which shouldn't be a problem.

Thanks a lot!