class Result in Facets 8
The default implementation of the result interfaces.
Hierarchy
- class \Drupal\facets\Result\Result implements ResultInterface
Expanded class hierarchy of Result
39 files declare their use of Result
- ActiveWidgetOrderProcessor.php in src/
Plugin/ facets/ processor/ ActiveWidgetOrderProcessor.php - ActiveWidgetOrderProcessorTest.php in tests/
src/ Unit/ Plugin/ processor/ ActiveWidgetOrderProcessorTest.php - BooleanItemProcessorTest.php in tests/
src/ Unit/ Plugin/ processor/ BooleanItemProcessorTest.php - CountLimitProcessorTest.php in tests/
src/ Unit/ Plugin/ processor/ CountLimitProcessorTest.php - CountWidgetOrderProcessor.php in src/
Plugin/ facets/ processor/ CountWidgetOrderProcessor.php
File
- src/
Result/ Result.php, line 11
Namespace
Drupal\facets\ResultView source
class Result implements ResultInterface {
/**
* The facet related to the result.
*
* @var \Drupal\facets\FacetInterface
*/
protected $facet;
/**
* The facet value.
*
* @var string
*/
protected $displayValue;
/**
* The raw facet value.
*
* @var string
*/
protected $rawValue;
/**
* The facet count.
*
* @var int
*/
protected $count = 0;
/**
* The Url object.
*
* @var \Drupal\Core\Url
*/
protected $url;
/**
* Is this a selected value or not.
*
* @var bool
*/
protected $active = FALSE;
/**
* Children results.
*
* @var \Drupal\facets\Result\ResultInterface[]
*/
protected $children = [];
/**
* Constructs a new result value object.
*
* @param \Drupal\facets\FacetInterface $facet
* The facet related to the result.
* @param mixed $raw_value
* The raw value.
* @param mixed $display_value
* The formatted value.
* @param int $count
* The amount of items.
*/
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;
}
/**
* {@inheritdoc}
*/
public function getDisplayValue() {
return $this->displayValue;
}
/**
* {@inheritdoc}
*/
public function getRawValue() {
return $this->rawValue;
}
/**
* {@inheritdoc}
*/
public function getCount() {
return $this->count;
}
/**
* {@inheritdoc}
*/
public function setCount($count) {
$this->count = (int) $count;
}
/**
* {@inheritdoc}
*/
public function getUrl() {
return $this->url;
}
/**
* {@inheritdoc}
*/
public function setUrl(Url $url) {
$this->url = $url;
}
/**
* {@inheritdoc}
*/
public function setActiveState($active) {
$this->active = $active;
}
/**
* {@inheritdoc}
*/
public function isActive() {
return $this->active;
}
/**
* {@inheritdoc}
*/
public function setDisplayValue($display_value) {
$this->displayValue = $display_value;
}
/**
* {@inheritdoc}
*/
public function setChildren(array $children) {
$this->children = $children;
}
/**
* {@inheritdoc}
*/
public function getChildren() {
return $this->children;
}
/**
* Returns true if the value has active children(selected).
*
* @return bool
* A boolean indicating the active state of children.
*/
public function hasActiveChildren() {
foreach ($this
->getChildren() as $child) {
if ($child
->isActive() || $child
->hasActiveChildren()) {
return TRUE;
}
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getFacet() {
return $this->facet;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Result:: |
protected | property | Is this a selected value or not. | |
Result:: |
protected | property | Children results. | |
Result:: |
protected | property | The facet count. | |
Result:: |
protected | property | The facet value. | |
Result:: |
protected | property | The facet related to the result. | |
Result:: |
protected | property | The raw facet value. | |
Result:: |
protected | property | The Url object. | |
Result:: |
public | function |
Returns children results. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns the count for the result. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns the display value as present in the index. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns the facet related to the result. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns the raw value as present in the index. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns the url. Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns true if the value has active children(selected). Overrides ResultInterface:: |
|
Result:: |
public | function |
Returns true if the value is active (selected). Overrides ResultInterface:: |
|
Result:: |
public | function |
Indicates that the value is active (selected). Overrides ResultInterface:: |
|
Result:: |
public | function |
Sets children results. Overrides ResultInterface:: |
|
Result:: |
public | function |
Sets the count for the result. Overrides ResultInterface:: |
|
Result:: |
public | function |
Overrides the display value of a result. Overrides ResultInterface:: |
|
Result:: |
public | function |
Sets the url. Overrides ResultInterface:: |
|
Result:: |
public | function | Constructs a new result value object. |