function FieldPluginBase::theme

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

File

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

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function theme(ResultRow $values) {
  $renderer = $this->getRenderer();
  $build = [
    '#theme' => $this->themeFunctions(),
    '#view' => $this->view,
    '#field' => $this,
    '#row' => $values,
  ];
  $output = $renderer->render($build);
  // Set the bubbleable rendering metadata on $view->element. This ensures the
  // bubbleable rendering metadata of individual rendered fields is not lost.
  // @see \Drupal\Core\Render\Renderer::updateStack()
  $this->view->element = $renderer->mergeBubbleableMetadata($this->view->element, $build);
  return $output;
}

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