I’m creating a new theme and am trying to customize browse.php in the items folder. What variables are being passed that I can use to get the Collection when that is part of the querystring?
I see $total_results and items and the helper public_nav_items() returns a ul with an li using the class collection where the Collection name is rendered but how can I get either the Collection id passed in the querystring to look up the Collection or is there an existing object on the page with the Collection information?
I think you’re actually looking at item_search_filters(), which produces a ul from the query string. I don’t think you need anything in that though.
You can get the collection id via $_GET, then use that with get_record_by_id() to get the collection record. I think that should get you what you’re looking for.
Here’s an example that does all that for use with record_image() to show the collection thumbnail.
Unfortunately that’s not what I’m trying to do. I’m on the page browse.php under items and it has been passed the querystring collection=? where the question mark is the number of the collection it uses to filter the results rather than showing all items it only shows the items within that Collection. URL on my test site is http://localhost/items/browse?collection=3.
There’s a function item_search_filters() that generates this HTML:
The collection name (in this case Archon) is what I want as I want to incorporate it into the breadcrumbs and page title rather than have it placed by this function. If it comes down to it I will just parse the querystring myself and fetch the Collection by that ID but it seems to me if the item_search_filters() function works without parameters it must know what Collection is involved so I’m hoping there’s an existing variable on the page with that Collection name or the ID I can use for the lookup.
What Kim wrote above is how you’d do this. In her example you’d just change the record_image line to something like echo metadata($collectionRecord, array('Dublin Core', 'Title')); to print the collection title rather than show the image.
item_search_filters is just doing the same basic process internally.