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

Breadcrumb

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

function FieldPluginBase::addSelfTokens

Add any special tokens this field might use for itself.

This method is intended to be overridden by items that generate fields as a list. For example, the field that displays all terms on a node might have tokens for the tid and the term.

By convention, tokens should follow the format of {{ token__subtoken }} where token is the field ID and subtoken is the field. If the field ID is terms, then the tokens might be {{ terms__tid }} and {{ terms__name }}.

1 call to FieldPluginBase::addSelfTokens()
FieldPluginBase::getRenderTokens in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Gets the 'render' tokens to use for advanced rendering.
3 methods override FieldPluginBase::addSelfTokens()
EntityField::addSelfTokens in core/modules/views/src/Plugin/views/field/EntityField.php
Add any special tokens this field might use for itself.
Roles::addSelfTokens in core/modules/user/src/Plugin/views/field/Roles.php
Add any special tokens this field might use for itself.
TaxonomyIndexTid::addSelfTokens in core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php
Add any special tokens this field might use for itself.

File

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

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

protected function addSelfTokens(&$tokens, $item) {
}

API Navigation

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