function ViewsViewFieldStatusTest::renderStatusField

Renders the status field of a single row through the theme system.

Parameters

\Drupal\views\ViewExecutable $view: An executed view with a field with the ID 'status'.

\Drupal\views\ResultRow $row: The row to render the field of.

Return value

string The rendered field output, without surrounding whitespace.

2 calls to ViewsViewFieldStatusTest::renderStatusField()
ViewsViewFieldStatusTest::renderStatusFieldByMarker in core/themes/default_admin/tests/src/Kernel/ViewsViewFieldStatusTest.php
Renders the status field of every row of a view, keyed by marker class.
ViewsViewFieldStatusTest::testFieldWithoutEntity in core/themes/default_admin/tests/src/Kernel/ViewsViewFieldStatusTest.php
Tests that a field of a handler without an entity has no marker.

File

core/themes/default_admin/tests/src/Kernel/ViewsViewFieldStatusTest.php, line 395

Class

ViewsViewFieldStatusTest
Tests the publication status marker of views status fields.

Namespace

Drupal\Tests\default_admin\Kernel

Code

protected function renderStatusField(ViewExecutable $view, ResultRow $row) : string {
  $field = $view->field['status'];
  $build = [
    '#theme' => $field->themeFunctions(),
    '#view' => $view,
    '#field' => $field,
    '#row' => $row,
  ];
  return trim((string) \Drupal::service('renderer')->renderInIsolation($build));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.