You are here

class SearchRow in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/search/src/Plugin/views/row/SearchRow.php \Drupal\search\Plugin\views\row\SearchRow
  2. 9 core/modules/search/src/Plugin/views/row/SearchRow.php \Drupal\search\Plugin\views\row\SearchRow

Row handler plugin for displaying search results.

Plugin annotation


@ViewsRow(
  id = "search_view",
  title = @Translation("Search results"),
  help = @Translation("Provides a row plugin to display search results.")
)

Hierarchy

  • class \Drupal\search\Plugin\views\row\SearchRow extends \Drupal\views\Plugin\views\row\RowPluginBase

Expanded class hierarchy of SearchRow

File

core/modules/search/src/Plugin/views/row/SearchRow.php, line 17

Namespace

Drupal\search\Plugin\views\row
View source
class SearchRow extends RowPluginBase {

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();
    $options['score'] = [
      'default' => TRUE,
    ];
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    $form['score'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Display score'),
      '#default_value' => $this->options['score'],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function render($row) {
    return [
      '#theme' => $this
        ->themeFunctions(),
      '#view' => $this->view,
      '#options' => $this->options,
      '#row' => $row,
    ];
  }

}

Members