AcquiaDAM_Search.inc in Media: Acquia DAM 7
File
src/AcquiaDAM/AcquiaDAM_Search.inc
View source
<?php
class AcquiaDAM_Search {
protected $depends = [];
public function __construct(array $depends = []) {
$this->depends = $depends;
if (empty($this->depends['client'])) {
$this->depends['client'] = AcquiaDAM_API::getClient();
}
}
public function search($phrase, array $options = []) {
$options += [
'query' => $phrase,
'folderid' => NULL,
'sortby' => 'datecreated',
'sortdir' => 'asc',
'limit' => 50,
'offset' => 0,
'types' => '',
'searchfield' => '',
'facets' => 'all',
];
if (is_array($options['types'])) {
$options['types'] = implode(',', $options['types']);
}
return $this->depends['client']
->request('search', $options);
}
}