protected function CoreViewsContextualFilter::loadFacetCoreViewsContextualFilterTypePlugin in Core Views Facets 8
Load the core_views_facet contextual filter type or fall back to generic.
Parameters
\Drupal\views\Plugin\views\argument\ArgumentPluginBase $argument: The views filter handler.
Return value
\Drupal\core_views_facets\CoreViewsFacetsFilterTypeInterface The loaded filter type plugin or null.
Throws
\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.
1 call to CoreViewsContextualFilter::loadFacetCoreViewsContextualFilterTypePlugin()
- CoreViewsContextualFilter::fillFacetsWithResults in src/
Plugin/ facets/ facet_source/ CoreViewsContextualFilter.php
File
- src/
Plugin/ facets/ facet_source/ CoreViewsContextualFilter.php, line 248
Class
- CoreViewsContextualFilter
- Represents a facet source of the core views with contextual filters.
Namespace
Drupal\core_views_facets\Plugin\facets\facet_sourceCode
protected function loadFacetCoreViewsContextualFilterTypePlugin(ArgumentPluginBase $argument) {
$filter_type_definitions = $this->contextualFilterTypePluginManager
->getDefinitions();
$custom_filter_id = $argument->view
->id() . '-' . $argument->field;
// Allows to handle custom scenarios.
if (!empty($filter_type_definitions[$custom_filter_id])) {
/** @var \Drupal\core_views_facets\CoreViewsFacetsFilterTypeInterface $facet_core_views_filter_plugin */
$facet_core_views_filter_plugin = $this->contextualFilterTypePluginManager
->createInstance($custom_filter_id);
}
elseif (!empty($filter_type_definitions[$argument->pluginId])) {
/** @var \Drupal\core_views_facets\CoreViewsFacetsFilterTypeInterface $facet_core_views_filter_plugin */
$facet_core_views_filter_plugin = $this->contextualFilterTypePluginManager
->createInstance($argument->pluginId);
}
else {
/** @var \Drupal\core_views_facets\CoreViewsFacetsFilterTypeInterface $facet_core_views_filter_plugin */
$facet_core_views_filter_plugin = $this->contextualFilterTypePluginManager
->createInstance('generic');
}
return $facet_core_views_filter_plugin;
}