You are here

protected function View::getTokenArgument in Views Field View 8

Return the argument type and raw argument from a token. E.g. {{ raw_arguments.null }} will return "array('type' => 'raw_arguments', 'id' => null)".

Parameters

string $token: A single token string.

Return value

array An array containing type and arg (As described above).

1 call to View::getTokenArgument()
View::getTokenValue in src/Plugin/views/field/View.php
Gets field values from tokens.

File

src/Plugin/views/field/View.php, line 337

Class

View
Plugin annotation @ViewsField("view");

Namespace

Drupal\views_field_view\Plugin\views\field

Code

protected function getTokenArgument($token) {

  // Trim whitespace and remove the brackets around the token.
  preg_match('{{\\s?(?<type>[a-z_0-9]+)\\.(?<id>[a-z_0-9]+)\\s?}}', $token, $match);
  return [
    'type' => $match['type'],
    'id' => $match['id'],
  ];
}