protected function TranslateEntityAggregatedFieldProcessor::overWriteDisplayValues in Facets 8
Overwrite the display value of the result with a new text.
Parameters
\Drupal\facets\Result\ResultInterface[] $results: An array of results to work on.
array $replacements: An array of values that contain possible replacements for the original values.
Return value
\Drupal\facets\Result\ResultInterface[] The changed results.
1 call to TranslateEntityAggregatedFieldProcessor::overWriteDisplayValues()
- TranslateEntityAggregatedFieldProcessor::build in src/
Plugin/ facets/ processor/ TranslateEntityAggregatedFieldProcessor.php - Runs before the renderable array is created.
File
- src/
Plugin/ facets/ processor/ TranslateEntityAggregatedFieldProcessor.php, line 206
Class
- TranslateEntityAggregatedFieldProcessor
- Transforms the results to show the translated entity label.
Namespace
Drupal\facets\Plugin\facets\processorCode
protected function overWriteDisplayValues(array $results, array $replacements) {
/** @var \Drupal\facets\Result\ResultInterface $a */
foreach ($results as &$a) {
if (isset($replacements[$a
->getRawValue()])) {
$a
->setDisplayValue($replacements[$a
->getRawValue()]);
}
}
return $results;
}