3 namespace Drupal\views_test_data\Plugin\views\row;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\views\Plugin\views\row\RowPluginBase;
9 * Provides a general test row plugin.
11 * @ingroup views_row_plugins
15 * title = @Translation("Test row plugin"),
16 * help = @Translation("Provides a generic row test plugin."),
17 * theme = "views_view_row_test",
18 * display_types = {"normal", "test"}
21 class RowTest extends RowPluginBase {
24 * A string which will be output when the view is rendered.
33 protected function defineOptions() {
34 $options = parent::defineOptions();
35 $options['test_option'] = ['default' => ''];
43 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
44 parent::buildOptionsForm($form, $form_state);
46 $form['test_option'] = [
47 '#title' => $this->t('Test option'),
48 '#type' => 'textfield',
49 '#description' => $this->t('This is a textfield for test_option.'),
50 '#default_value' => $this->options['test_option'],
55 * Sets the output property.
57 * @param string $output
58 * The string to output by this plugin.
60 public function setOutput($output) {
61 $this->output = $output;
65 * Returns the output property.
69 public function getOutput() {
76 public function render($row) {
77 return $this->getOutput();
83 public function calculateDependencies() {
85 'content' => ['RowTest'],