Score.php in Drupal 9
File
core/modules/search/src/Plugin/views/field/Score.php
View source
<?php
namespace Drupal\search\Plugin\views\field;
use Drupal\views\Plugin\views\field\NumericField;
use Drupal\views\ResultRow;
class Score extends NumericField {
public function query() {
foreach ($this->view->filter as $handler) {
if (isset($handler->search_score) && $handler->relationship == $this->relationship) {
$this->field_alias = $handler->search_score;
$this->tableAlias = $handler->tableAlias;
return;
}
}
$this->options['exclude'] = TRUE;
}
public function render(ResultRow $values) {
if (isset($this->tableAlias)) {
return parent::render($values);
}
}
}
Classes
Name |
Description |
Score |
Field handler for search score. |