You are here

public function YamlFormTokenManager::buildTreeLink in YAML Form 8

Build token tree link if token.module is installed.

Overrides YamlFormTokenManagerInterface::buildTreeLink

File

src/YamlFormTokenManager.php, line 73

Class

YamlFormTokenManager
Defines a class to manage token replacement.

Namespace

Drupal\yamlform

Code

public function buildTreeLink() {
  if ($this->moduleHandler
    ->moduleExists('token')) {

    // @todo Issue #2235581: Make Token Dialog support inserting in WYSIWYGs.
    return [
      '#theme' => 'token_tree_link',
      '#token_types' => [
        'yamlform',
        'yamlform_submission',
      ],
      '#click_insert' => FALSE,
      '#dialog' => TRUE,
    ];
  }
  else {
    return [];
  }
}