You are here

function theme_flag_lists_tokens_browser in Flag Lists 8

Same name and namespace in other branches
  1. 4.0.x flag_lists.tokens.inc \theme_flag_lists_tokens_browser()

Returns HTML for a tokens browser.

Parameters

array $variables: An associative array containing:

  • types: An array naming the types of tokens to show.
  • global_types: Whether to show global tokens.

File

./flag_lists.tokens.inc, line 90
Flag lists module tokens support.

Code

function theme_flag_lists_tokens_browser(array $variables) {
  $types = $variables['types'];
  $global_types = $variables['global_types'];
  if (\Drupal::moduleHandler()
    ->moduleExists('token')) {
    return theme('token_tree', [
      'token_types' => $types,
      'global_types' => $global_types,
    ]);
  }
  else {
    return '<p><em>' . t("Note: You don't have the <a href='@token-url'>Token</a> module installed, so the list of available tokens isn't shown here. You don't have to install <a href='@token-url'>Token</a> to be able to use tokens, but if you have it installed, and enabled, you'll be able to enjoy an interactive tokens browser.", [
      '@token-url' => 'http://drupal.org/project/token',
    ]) . '</em></p>';
  }
}