Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldPluginBase.php

function FieldPluginBase::theme

Overrides FieldHandlerInterface::theme

File

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

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal