Result.php in Facets 8
File
src/Result/Result.php
View source
<?php
namespace Drupal\facets\Result;
use Drupal\Core\Url;
use Drupal\facets\FacetInterface;
class Result implements ResultInterface {
protected $facet;
protected $displayValue;
protected $rawValue;
protected $count = 0;
protected $url;
protected $active = FALSE;
protected $children = [];
public function __construct(FacetInterface $facet, $raw_value, $display_value, $count) {
$this->facet = $facet;
$this->rawValue = $raw_value;
$this->displayValue = $display_value;
$this->count = (int) $count;
}
public function getDisplayValue() {
return $this->displayValue;
}
public function getRawValue() {
return $this->rawValue;
}
public function getCount() {
return $this->count;
}
public function setCount($count) {
$this->count = (int) $count;
}
public function getUrl() {
return $this->url;
}
public function setUrl(Url $url) {
$this->url = $url;
}
public function setActiveState($active) {
$this->active = $active;
}
public function isActive() {
return $this->active;
}
public function setDisplayValue($display_value) {
$this->displayValue = $display_value;
}
public function setChildren(array $children) {
$this->children = $children;
}
public function getChildren() {
return $this->children;
}
public function hasActiveChildren() {
foreach ($this
->getChildren() as $child) {
if ($child
->isActive() || $child
->hasActiveChildren()) {
return TRUE;
}
}
return FALSE;
}
public function getFacet() {
return $this->facet;
}
}
Classes
Name |
Description |
Result |
The default implementation of the result interfaces. |