function FieldPluginBase::postRender

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::postRender()
  2. 8.9.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::postRender()
  3. 11.x core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::postRender()

Runs after every field has been rendered.

This is meant to be used mainly to deal with field handlers whose output cannot be cached at row level but can be cached at display level. The typical example is the row counter. For completely uncacheable field output placeholders should be used.

Parameters

\Drupal\views\ResultRow $row: An array of all ResultRow objects returned from the query.

$output: The field rendered output.

Return value

string[] An associative array of post-render token values keyed by placeholder.

Overrides FieldHandlerInterface::postRender

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 1179

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function postRender(ResultRow $row, $output) {
    // Make sure the last rendered value is available also when this is
    // retrieved from cache.
    $this->last_render = $output;
    return [];
}

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