I'm currently converting a monstrously text-heavy exhibit to Omeka. In the exhibit's current Drupal incarnation, there's a search box specifically devoted to it. I'd like to bring that to the Omeka exhibit without creating a separate installation, but my understanding of how the site-wide search is constructed isn't very good. I know how to embed a search box, but I haven't even managed to get results limited to Exhibit Pages (never mind to one specific exhibit) without having the advanced dropdown. I tried doing that with
array('options' => $options,
'record_types' => "ExhibitPage"));
..but no dice. I've also tried looking at the Zend query documentation, but it's not terribly friendly. I don't need users to be able to do an advanced search, I just need a keyword search box limited on the back end to exhibit pages in a specific exhibit.
Any pointers on where to start without resorting to SQL queries in my PHP would be most welcome.
Ah, of course,
record_types has to be an array. Some progress, at least!
I ended up creating a mostly successful shortcode to do this.
The one question remaining is, how do I make it so that submitting the search goes to a index.php in the plugin's view folder, instead of to
search/index.php in my theme?
Does your new page actually handle the searching/results itself?
Changing the action the form submits to is easy enough, just set
$options['form_attributes']['action'] to the URL you want it to submit to.
The page is just a copy of the usual search
index.php, with a conditional added to only show results that match the child pages for the exhibit id in the query string.
Tried that, but using the full path to the view (with or without index.php) returns a 404, and using a view partial just sends the entire view's code to the address bar. I'd like to be able to have the results page inside the plugin, rather than putting it in files or the theme.
I'm guessing it has something to do with adding routes, but it's not entirely clear to me how I'd add one. (e.g. it's a shortcode plugin and has no controllers.. so what do I put as the value for
Hmmm, okay. You'd have to add a controller for this. In this situation, it may be enough for the controller to just
extend the SearchController, making it basically just a copy of the normal one from the core. You automatically have a route to any plugin controllers at
plugin-name/controller-name/action-name, but you could add a different route if you wanted.