mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 21:34:59 +00:00
allow json in search response and abstract interactive loading from select2
This commit is contained in:
@@ -157,17 +157,18 @@ class SearchProvider
|
||||
|
||||
/**
|
||||
* search through services which supports domain and give
|
||||
* results as html string
|
||||
* results as an array of resultsfrom different SearchInterface
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param number $start
|
||||
* @param number $limit
|
||||
* @param array $options
|
||||
* @return array of html results
|
||||
* @param string $format
|
||||
* @return array of results from different SearchInterface
|
||||
* @throws UnknowSearchDomainException if the domain is unknow
|
||||
*/
|
||||
public function getSearchResults($pattern, $start = 0, $limit = 50,
|
||||
array $options = array())
|
||||
array $options = array(), $format = 'html')
|
||||
{
|
||||
$terms = $this->parse($pattern);
|
||||
$results = array();
|
||||
@@ -180,7 +181,7 @@ class SearchProvider
|
||||
|
||||
if ($terms['_domain'] !== NULL) {
|
||||
foreach ($sortedSearchServices as $service) {
|
||||
if ($service->supports($terms['_domain'])) {
|
||||
if ($service->supports($terms['_domain'], $format)) {
|
||||
$results[] = $service->renderResult($terms, $start, $limit, $options);
|
||||
}
|
||||
}
|
||||
@@ -203,7 +204,7 @@ class SearchProvider
|
||||
}
|
||||
|
||||
public function getResultByName($pattern, $name, $start = 0, $limit = 50,
|
||||
array $options = array())
|
||||
array $options = array(), $format)
|
||||
{
|
||||
$terms = $this->parse($pattern);
|
||||
$search = $this->getByName($name);
|
||||
@@ -213,7 +214,7 @@ class SearchProvider
|
||||
throw new ParsingException("The domain is not supported for the search name");
|
||||
}
|
||||
|
||||
return $search->renderResult($terms, $start, $limit, $options);
|
||||
return $search->renderResult($terms, $start, $limit, $options, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user