RowTest.php in Drupal 10
File
core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php
View source
<?php
namespace Drupal\views_test_data\Plugin\views\row;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\RowPluginBase;
class RowTest extends RowPluginBase {
public $output;
protected function defineOptions() {
$options = parent::defineOptions();
$options['test_option'] = [
'default' => '',
];
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['test_option'] = [
'#title' => $this
->t('Test option'),
'#type' => 'textfield',
'#description' => $this
->t('This is a textfield for test_option.'),
'#default_value' => $this->options['test_option'],
];
}
public function setOutput($output) {
$this->output = $output;
}
public function getOutput() {
return $this->output;
}
public function render($row) {
return $this
->getOutput();
}
public function calculateDependencies() {
return [
'content' => [
'RowTest',
],
];
}
}
Classes
Name |
Description |
RowTest |
Provides a general test row plugin. |