Skip to content
Snippets Groups Projects
Commit 780cebef authored by Demian Katz's avatar Demian Katz
Browse files

More lenient limit verification to ease combined config.

parent 09bd1b3a
No related merge requests found
......@@ -15,8 +15,7 @@
; it will display the standard "no results" message.
; limit = The maximum number of search results to show in this column; note
; that this must be a legal limit value for the chosen search backend.
; (Setting legal limit values may require changing limit_options in
; the appropriate configuration file -- e.g. searches.ini, Summon.ini).
; (may sometimes require config changes -- e.g. searches.ini, Summon.ini).
;
; All display text is subject to translation and may be added to the language
; .ini files.
......
......@@ -310,8 +310,16 @@ class Params implements ServiceLocatorAwareInterface
// Check for a limit parameter in the url.
$defaultLimit = $this->getOptions()->getDefaultLimit();
if (($limit = $request->get('limit')) != $defaultLimit) {
// make sure the url parameter is a valid limit
if (in_array($limit, $this->getOptions()->getLimitOptions())) {
// make sure the url parameter is a valid limit -- either
// one of the explicitly allowed values, or at least smaller
// than the largest allowed. (This leniency is useful in
// combination with combined search, where it is often useful
// to reduce the size of result lists without actually enabling
// the user's ability to select a reduced list size).
$legalOptions = $this->getOptions()->getLimitOptions();
if (in_array($limit, $legalOptions)
|| ($limit > 0 && $limit < max($legalOptions))
) {
$this->limit = $limit;
return;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment