Struct goose_eggs::drupal::SearchParams [−][src]
pub struct SearchParams<'a> { /* fields omitted */ }
Expand description
Set parameters for making and validating a search.
Implementations
Create a new SearchParams
object, specifying keys
, url
, the name of the
submit
button, and the title
of the search page. This object is passed to
the search
function.
It is recommended to use a helper such as SearchParams::keys
together with
SearchParams::update_url
, SearchParams::update_submit
, and/or
SearchParams::update_title
instead of invoking this function directly.
Example
use goose_eggs::drupal::SearchParams; // Search for "search terms". let search = SearchParams::new(Some("search terms"), Some("custom/search/path"), Some("Custom Search"), Some("Custom Search"));
Create a SearchParams
object setting the string to search for.
This object is passed to the search
function.
The search form url will remain the default of search
, and can be changed by
invoking SearchParams::update_url
. The search form submit button will remain
the default of Search
, and can be changed by invoking
SearchParams::update_submit
Example
use goose_eggs::drupal::SearchParams; // Search for "search terms". let search = SearchParams::keys("search terms");
Modify a SearchParams
object setting a custom url for the search form.
This object is passed to the search
function.
The SearchParams
object is created by calling SearchParams::keys
, then
it is chained to this function to set a custom url. The search form submit
button will remain the default of Search
, or whatever is set by invoking
SearchParams::update_submit
.
Example
use goose_eggs::drupal::SearchParams; // Search for "search terms" using a form with a custom path. let search = SearchParams::keys("search terms") .update_url("custom/search/path");
Modify a SearchParams
object setting a custom submit button for the search
form.
This object is passed to the search
function.
The SearchParams
object is created by calling SearchParams::keys
, then
it is chained to this function to set a custom submit button. The search form
url will remain the default of search
, or whatever is set by invoking
SearchParams::update_url
.
Example
use goose_eggs::drupal::SearchParams; // Search for "search terms" with a form that has a custom submit botton. let search = SearchParams::keys("search terms") .update_submit("Custom Search");
Modify a SearchParams
object to validate the title of the search form page.
This object is passed to the search
function.
The SearchParams
object is created by calling SearchParams::keys
, then
it is chained to this function to validate the search form page title.
Example
use goose_eggs::drupal::SearchParams; // Search for "search terms" with a form on a page with title "Search". let search = SearchParams::keys("search terms") .update_title("Search");
Modify a SearchParams
object changing the string that is searched for.
This object is passed to the search
function.
This function allows a mutable SearchParams
object to be created with a
custom url and/or submit button and then to be used for multiple different
searches.
Example
use goose_eggs::drupal::SearchParams; // First search for "search terms" using a form on a custom path. let mut search = SearchParams::keys("search terms") .update_url("custom/search/path"); // Perform a search here ... // Then search for "different search terms" at the same custom path. search.update_keys("different search terms");