Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 17 |
SearchRow | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 17 |
defineOptions | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
buildOptionsForm | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 6 |
|||
render | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\search\Plugin\views\row\SearchRow. | |
*/ | |
namespace Drupal\search\Plugin\views\row; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\views\Plugin\views\row\RowPluginBase; | |
/** | |
* Row handler plugin for displaying search results. | |
* | |
* @ViewsRow( | |
* id = "search_view", | |
* title = @Translation("Search results"), | |
* help = @Translation("Provides a row plugin to display search results.") | |
* ) | |
*/ | |
class SearchRow extends RowPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
protected function defineOptions() { | |
$options = parent::defineOptions(); | |
$options['score'] = array('default' => TRUE); | |
return $options; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function buildOptionsForm(&$form, FormStateInterface $form_state) { | |
$form['score'] = array( | |
'#type' => 'checkbox', | |
'#title' => $this->t('Display score'), | |
'#default_value' => $this->options['score'], | |
); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function render($row) { | |
return array( | |
'#theme' => $this->themeFunctions(), | |
'#view' => $this->view, | |
'#options' => $this->options, | |
'#row' => $row, | |
); | |
} | |
} |