public function SearchApiDate::__construct in Facets 8
Constructs a \Drupal\Component\Plugin\PluginBase object.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
Overrides QueryTypePluginBase::__construct
File
- src/
Plugin/ facets/ query_type/ SearchApiDate.php, line 59
Class
- SearchApiDate
- Support for date facets within the Search API scope.
Namespace
Drupal\facets\Plugin\facets\query_typeCode
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$facet = $configuration['facet'];
$processors = $facet
->getProcessors();
$dateProcessorConfig = $processors['date_item']
->getConfiguration();
$configuration = $this
->getConfiguration();
$configuration['granularity'] = $dateProcessorConfig['granularity'];
$configuration['date_display'] = $dateProcessorConfig['date_display'];
$configuration['date_format'] = $dateProcessorConfig['date_format'];
$this
->setConfiguration($configuration);
}