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

Breadcrumb

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

function Roles::addSelfTokens

Overrides FieldPluginBase::addSelfTokens

File

core/modules/user/src/Plugin/views/field/Roles.php, line 103

Class

Roles
Field handler to provide a list of roles.

Namespace

Drupal\user\Plugin\views\field

Code

protected function addSelfTokens(&$tokens, $item) {
    if (!empty($item['role'])) {
        $tokens['{{ ' . $this->options['id'] . '__role }}'] = $item['role'];
        $tokens['{{ ' . $this->options['id'] . '__rid }}'] = $item['rid'];
    }
}

API Navigation

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