updated to 7.x-1.11

This commit is contained in:
Bachir Soussi Chiadmi
2014-02-07 10:01:18 +01:00
parent a30917d1d2
commit cf03e9ca52
69 changed files with 4629 additions and 1557 deletions

View File

@@ -109,7 +109,12 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
public function addFacet(array $facet, SearchApiQueryInterface $query) {
if (isset($this->fields[$facet['name']])) {
$options = &$query->getOptions();
$options['search_api_facets'][$facet['name']] = $this->fields[$facet['name']];
$facet_info = $this->fields[$facet['name']];
if (!empty($facet['query_options'])) {
// Let facet-specific query options override the set options.
$facet_info = $facet['query_options'] + $facet_info;
}
$options['search_api_facets'][$facet['name']] = $facet_info;
}
}
@@ -139,7 +144,7 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
// I suspect that http://drupal.org/node/593658 would help.
// For now, just taking the first current search for this index. :-/
foreach (search_api_current_search() as $search) {
list($query, $results) = $search;
list($query) = $search;
if ($query->getIndex()->machine_name == $index_id) {
$this->current_search = $search;
}
@@ -196,7 +201,6 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
*/
public function settingsForm(&$form, &$form_state) {
$facet = $form['#facetapi']['facet'];
$realm = $form['#facetapi']['realm'];
$facet_settings = $this->getFacet($facet)->getSettings();
$options = $facet_settings->settings;
$search_ids = variable_get('search_api_facets_search_ids', array());
@@ -205,6 +209,7 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
$form['global']['default_true'] = array(
'#type' => 'select',
'#title' => t('Display for searches'),
'#prefix' => '<div class="facetapi-global-setting">',
'#options' => array(
TRUE => t('For all except the selected'),
FALSE => t('Only for the selected'),
@@ -214,6 +219,7 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
$form['global']['facet_search_ids'] = array(
'#type' => 'select',
'#title' => t('Search IDs'),
'#suffix' => '</div>',
'#options' => $search_ids,
'#size' => min(4, count($search_ids)),
'#multiple' => TRUE,
@@ -246,9 +252,25 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
'#type' => 'select',
'#title' => t('Granularity'),
'#description' => t('Determine the maximum drill-down level'),
'#prefix' => '<div class="facetapi-global-setting">',
'#suffix' => '</div>',
'#options' => $granularity_options,
'#default_value' => isset($options['date_granularity']) ? $options['date_granularity'] : FACETAPI_DATE_MINUTE,
);
}
// Add an "Exclude" option for terms.
if(!empty($facet['query types']) && in_array('term', $facet['query types'])) {
$form['global']['operator']['#weight'] = -2;
unset($form['global']['operator']['#suffix']);
$form['global']['exclude'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude'),
'#description' => t('Make the search exclude selected facets, instead of restricting it to them.'),
'#suffix' => '</div>',
'#weight' => -1,
'#default_value' => !empty($options['exclude']),
);
}
}
}