SearchRow.php in Drupal 10
File
core/modules/search/src/Plugin/views/row/SearchRow.php
View source
<?php
namespace Drupal\search\Plugin\views\row;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\RowPluginBase;
class SearchRow extends RowPluginBase {
protected function defineOptions() {
$options = parent::defineOptions();
$options['score'] = [
'default' => TRUE,
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['score'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display score'),
'#default_value' => $this->options['score'],
];
}
public function render($row) {
return [
'#theme' => $this
->themeFunctions(),
'#view' => $this->view,
'#options' => $this->options,
'#row' => $row,
];
}
}
Classes
Name |
Description |
SearchRow |
Row handler plugin for displaying search results. |