Customizing properties in item and item set search

Here is the structure of the built-in search forms:

/theme/view/omeka/site/item/search.phtml
/theme/view/omeka/site/item-set/search.phtml

If your theme doesn’t have these files, they can be copied out of /application/view/omeka/site/item and /theme/view/omeka/site/item-set.

Inside each search.phtml file, it references a “partial”:
/theme/view/common/advanced-search

This actually refers not to a directory but the /theme/view/common/advanced-search.phtml file.

By default, the search files are exactly the same between items and item sets.

To customize the item set search, you can create a separate /item-set/search.phtml file in your theme, and then point it to a copy of /common/advanced-search.phtml, for example, /common/itemset-search.phtml.

Inside the common partial file (e.g. advanced-search.phtml), it references another partial:
/common/advanced-search/resource-class
or
/common/advanced-search/properties

These again refer to .phtml files, e.g. /common/advanced-search/properties.phtml.

If your theme doesn’t have these files, it can be copied from /application/view/common/advanced-search (the directory).

To customize an item set search form, you can create a copy, e.g. /common/advanced-search/itemset-properties.phtml.

This is as far as I’ve gotten. I’m now trying to customize which properties are displayed in the drop-down in the item set advanced search, and can’t figure that out.

I see a $properties array, but when I run a print_r, it appears empty.

I see a $properties loop - foreach ($properties as $property) - but again right before this line, if I output the $properties array, it’s empty.

I see that inside the loop, the $property variable itself is also an array.

Where is the code that is populating the $property and $properties array? Or, how do I manually construct this array to point to specified properties? I know how to use Resource Templates to limit which properties are displayed - but this is shared between both items and item sets, there doesn’t seem to be a way in the UI to differentiate.


Ben Bakelaar
metascripta.org
edisondigital.rutgers.edu

Whoops, I had this open in a tab… somewhere many tabs left of what was actually visible on my tab bar.

The $properties array is just there for filling out the form when the user’s already done a search and is modifying it. They don’t affect what properties are shown as options in the <select> elements. The “magic” is all in $this->propertySelect, which calls the PropertySelect view helper that reads the list of all properties in the system to include them in the dropdown.

If you want to totally configure this, one option is simply to replace it completely with one that uses manually-specified options instead. You could write it out by hand as a <select> or use the Laminas code to output a customized one.

1 Like

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.