You are here

class RowTest in Drupal 10

Same name in this branch
  1. 10 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest
  2. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php \Drupal\views_test_data\Plugin\views\row\RowTest
Same name and namespace in other branches
  1. 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php \Drupal\views_test_data\Plugin\views\row\RowTest
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php \Drupal\views_test_data\Plugin\views\row\RowTest

Provides a general test row plugin.

Plugin annotation


@ViewsRow(
  id = "test_row",
  title = @Translation("Test row plugin"),
  help = @Translation("Provides a generic row test plugin."),
  theme = "views_view_row_test",
  display_types = {"normal", "test"}
)

Hierarchy

  • class \Drupal\views_test_data\Plugin\views\row\RowTest extends \Drupal\views\Plugin\views\row\RowPluginBase

Expanded class hierarchy of RowTest

1 file declares its use of RowTest
StyleTest.php in core/modules/views/tests/src/Kernel/Plugin/StyleTest.php
3 string references to 'RowTest'
RowTest::calculateDependencies in core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php
ViewEntityDependenciesTest::testGetDependencies in core/modules/views/tests/src/Kernel/Entity/ViewEntityDependenciesTest.php
Tests the getDependencies method.
views.view.test_plugin_dependencies.yml in core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_plugin_dependencies.yml

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php, line 21

Namespace

Drupal\views_test_data\Plugin\views\row
View source
class RowTest extends RowPluginBase {

  /**
   * A string which will be output when the view is rendered.
   *
   * @var string
   */
  public $output;

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

  /**
   * {@inheritdoc}
   */
  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'],
    ];
  }

  /**
   * Sets the output property.
   *
   * @param string $output
   *   The string to output by this plugin.
   */
  public function setOutput($output) {
    $this->output = $output;
  }

  /**
   * Returns the output property.
   *
   * @return string
   */
  public function getOutput() {
    return $this->output;
  }

  /**
   * {@inheritdoc}
   */
  public function render($row) {
    return $this
      ->getOutput();
  }

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return [
      'content' => [
        'RowTest',
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RowTest::$output public property A string which will be output when the view is rendered.
RowTest::buildOptionsForm public function
RowTest::calculateDependencies public function
RowTest::defineOptions protected function
RowTest::getOutput public function Returns the output property.
RowTest::render public function
RowTest::setOutput public function Sets the output property.