Term.php in Core Views Facets 8
File
src/Plugin/facets/processor/exposed_filter_type/Term.php
View source
<?php
namespace Drupal\core_views_facets\Plugin\facets\processor\exposed_filter_type;
use Drupal\core_views_facets\CoreViewsFacetsFilterType;
use Drupal\facets\FacetInterface;
use Drupal\views\Plugin\views\HandlerBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
class Term extends CoreViewsFacetsFilterType {
protected $storage;
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
$this->storage = $entity_type_manager
->getStorage('taxonomy_term');
}
public function processDatabaseRow(\stdClass $row, HandlerBase $handler, FacetInterface $facet) {
$result = parent::processDatabaseRow($row, $handler, $facet);
$result
->setDisplayValue($this->storage
->load($result
->getRawValue())
->label());
return $result;
}
}
Classes
Name |
Description |
Term |
Filter type "Term" for core_views_facets. |