You are here

function eva_get_arguments_from_token_string in EVA: Entity Views Attachment 8

Same name and namespace in other branches
  1. 7 eva.module \eva_get_arguments_from_token_string()

Get view arguments array from string that contains tokens

Parameters

$string: The token string defined by the view.

$type: The token type.

$object: The object being used for replacement data (typically a node).

Return value

An array of argument values.

1 call to eva_get_arguments_from_token_string()
eva_entity_view in ./eva.module
Implements hook_entity_view()

File

./eva.module, line 177
Module implementing EVA extra field and views display

Code

function eva_get_arguments_from_token_string($string, $type, $object) {
  $args = trim($string);
  if (empty($args)) {
    return array();
  }
  $args = \Drupal::token()
    ->replace($args, array(
    $type => $object,
  ), array(
    'sanitize' => FALSE,
  ));
  return explode('/', $args);
}