You are here

public function ApiTokenBase::placeholder in API Tokens 8

Same name and namespace in other branches
  1. 8.2 src/ApiTokenBase.php \Drupal\api_tokens\ApiTokenBase::placeholder()

Returns a #lazy_builder placeholder for the API tokens filter.

Return value

array A renderable array representing a placeholder.

Overrides ApiTokenPluginInterface::placeholder

File

src/ApiTokenBase.php, line 316

Class

ApiTokenBase
Provides a base class for the API token plugins.

Namespace

Drupal\api_tokens

Code

public function placeholder() {
  $placeholder = [
    '#lazy_builder' => [
      self::class . '::lazyBuilder',
      [
        $this->pluginId,
        $this->paramString,
        $this
          ->validateToken(),
      ],
    ],
    '#cache' => [
      'keys' => !self::$context ? [
        'api_token',
        $this->pluginId,
        $this->hash,
      ] : NULL,
    ],
  ];
  return $placeholder;
}