You are here

function views_send_token_help in Views Send 8

Theme the replacement tokens.

@todo: Add help for other tokens

Parameters

$tokens:: Keyed array with tokens as keys and description as values.

Return value

A themed table with all tokens.

1 call to views_send_token_help()
views_send_config_form in ./views_send.module
Implements the form for the "configure" step.

File

./views_send.module, line 940
The Views Send module.

Code

function views_send_token_help($fields) {
  $header = array(
    t('Token'),
    t('Replacement value'),
  );
  $rows = array();
  foreach ($fields as $field => $title) {
    $rows[] = array(
      VIEWS_SEND_TOKEN_PREFIX . sprintf(VIEWS_SEND_TOKEN_PATTERN, $field) . VIEWS_SEND_TOKEN_POSTFIX,
      $title,
    );
  }
  $table = array(
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  $output = \Drupal::service('renderer')
    ->render($table);
  return $output;
}