Drupal 7 вывод доступных токенов

  if (module_exists('token')) {
    $form['token_help'] = array(
      '#title' => t('Replacement patterns'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
//      '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!'),
      );
 
    $form['token_help']['help'] = array(
        '#theme' => 'token_tree',
        '#token_types' => array('node'), // The token types that have specific context. Can be multiple token types like 'term' and/or 'user'
        '#global_types' => TRUE, // A boolean TRUE or FALSE whether to include 'global' context tokens like [current-user:*] or [site:*]. Defaults to TRUE.
        '#click_insert' => TRUE, // A boolean whether to include the 'Click this token to insert in into the the focused textfield' JavaScript functionality. Defaults to TRUE.
      );
  }

Комментарии

Добавить комментарий