You are here

function _advanced_text_formatter_browse_tokens in Advanced Text Formatter 2.0.x

Same name and namespace in other branches
  1. 8 advanced_text_formatter.module \_advanced_text_formatter_browse_tokens()
  2. 7 advanced_text_formatter.module \_advanced_text_formatter_browse_tokens()
  3. 2.1.x advanced_text_formatter.module \_advanced_text_formatter_browse_tokens()

Get a link to browse for available tokens.

Parameters

mixed $token_types: A string or array contains the token types. See theme_token_tree() for more details.

Return value

string A HTML link

4 calls to _advanced_text_formatter_browse_tokens()
AdvancedTextFormatter::settingsForm in src/Plugin/Field/FieldFormatter/AdvancedTextFormatter.php
Returns a form to configure settings for the formatter.
AdvancedTextFormatterTokenTree::preRender in src/AdvancedTextFormatterTokenTree.php
Add available tokens link to text_format element.
_advanced_text_formatter_widget_textarea_alter in ./advanced_text_formatter.module
_advanced_text_formatter_widget_textfield_alter in ./advanced_text_formatter.module

File

./advanced_text_formatter.module, line 267
Advanced Text Formatter

Code

function _advanced_text_formatter_browse_tokens($token_types) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('token')) {
    return;
  }
  if (!is_array($token_types)) {
    $token_types = array(
      $token_types,
    );
  }
  $vars['token_types'] = $token_types;
  return \Drupal::theme()
    ->render('token_tree_link', $vars);
}