public function ApacheSolrFacetapiAdapter::settingsForm in Apache Solr Search 7
Same name and namespace in other branches
- 8 plugins/facetapi/adapter.inc \ApacheSolrFacetapiAdapter::settingsForm()
- 6.3 plugins/facetapi/adapter.inc \ApacheSolrFacetapiAdapter::settingsForm()
Allows for backend specific overrides to the settings form.
_state
Parameters
array $form:
File
- plugins/
facetapi/ adapter.inc, line 148 - Classes used by the Facet API module.
Class
- ApacheSolrFacetapiAdapter
- Facet API adapter for the Apache Solr Search Integration module.
Code
public function settingsForm(&$form, &$form_state) {
if (in_array('date', $form['#facetapi']['facet']['query types'])) {
$granularity = array(
FACETAPI_DATE_YEAR => t('Year'),
FACETAPI_DATE_MONTH => t('Month'),
FACETAPI_DATE_DAY => t('Day'),
FACETAPI_DATE_HOUR => t('Hour'),
FACETAPI_DATE_MINUTE => t('Minute'),
);
$facet = $form['#facetapi']['facet'];
$settings = $this
->getFacet($facet)
->getSettings()->settings;
$form['global']['date_granularity'] = array(
'#type' => 'select',
'#title' => t('Granularity'),
'#description' => t('Time intervals smaller than this will not be displayed in the facet.'),
'#options' => $granularity,
'#default_value' => isset($settings['date_granularity']) ? $settings['date_granularity'] : FACETAPI_DATE_MINUTE,
);
}
$form['#validate'][] = 'apachesolr_facet_form_validate';
}