function Path::render

Overrides FieldPluginBase::render

File

core/modules/node/src/Plugin/views/field/Path.php, line 70

Class

Path
Field handler to present the path to the node.

Namespace

Drupal\node\Plugin\views\field

Code

public function render(ResultRow $values) {
    $nid = $this->getValue($values, 'nid');
    return [
        '#markup' => Url::fromRoute('entity.node.canonical', [
            'node' => $nid,
        ], [
            'absolute' => $this->options['absolute'],
        ])
            ->toString(),
    ];
}

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