protected function JsonApiResponseWidget::generateValues in JSON:API Search API 8
Generates the value and the url.
Parameters
\Drupal\facets\Result\ResultInterface $result: The result to extract the values.
Return value
array The values.
3 calls to JsonApiResponseWidget::generateValues()
- JsonApiResponseWidget::build in modules/
jsonapi_search_api_facets/ src/ Plugin/ facets/ widget/ JsonApiResponseWidget.php - Builds the facet widget for rendering.
- JsonApiResponseWidget::buildChildren in modules/
jsonapi_search_api_facets/ src/ Plugin/ facets/ widget/ JsonApiResponseWidget.php - Builds an array for children results.
- JsonApiResponseWidget::prepare in modules/
jsonapi_search_api_facets/ src/ Plugin/ facets/ widget/ JsonApiResponseWidget.php - Prepares the URL and values for the facet.
File
- modules/
jsonapi_search_api_facets/ src/ Plugin/ facets/ widget/ JsonApiResponseWidget.php, line 125
Class
- JsonApiResponseWidget
- A simple widget class that returns for inclusion in JSON:API Search API.
Namespace
Drupal\jsonapi_search_api_facets\Plugin\facets\widgetCode
protected function generateValues(ResultInterface $result) {
$values = [
'value' => $result
->getRawValue(),
'label' => $result
->getDisplayValue(),
'active' => $result
->isActive(),
];
if ($this->configuration['show_numbers']) {
$values['count'] = (int) $result
->getCount();
}
return $values;
}