function StylePluginBase::getField

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getField()
  2. 10 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getField()
  3. 11.x core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::getField()

Gets a rendered field.

Parameters

int $index: The index count of the row.

string $field: The ID of the field.

Return value

\Drupal\Component\Render\MarkupInterface|null The output of the field, or NULL if it was empty.

1 call to StylePluginBase::getField()
StylePluginBase::renderGrouping in core/modules/views/src/Plugin/views/style/StylePluginBase.php
Group records as needed for rendering.

File

core/modules/views/src/Plugin/views/style/StylePluginBase.php, line 793

Class

StylePluginBase
Base class for views style plugins.

Namespace

Drupal\views\Plugin\views\style

Code

public function getField($index, $field) {
    if (!isset($this->rendered_fields)) {
        $this->renderFields($this->view->result);
    }
    if (isset($this->rendered_fields[$index][$field])) {
        return $this->rendered_fields[$index][$field];
    }
}

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