You are here

function nodewords_add_tokens_help in Nodewords: D6 Meta Tags 6.2

Same name and namespace in other branches
  1. 6.3 nodewords.module \nodewords_add_tokens_help()

Add the tokens help to the form.

Add the tokens help to the form passed as argument. It is responsability of the calling function to verify that token.module is enabled.

Parameters

&$form: The form to which the help text will be added.

$type: An array containing information about the object for which the meta tags are being edited.

1 call to nodewords_add_tokens_help()
nodewords_tags_edit_fields in ./nodewords.module
Return the form used to set the meta tags values.

File

./nodewords.module, line 247
Implement an API that other modules can use to add meta tags.

Code

function nodewords_add_tokens_help(&$form, $type) {

  // Always include the global context.
  $token_types[] = 'global';
  switch ($type['type']) {
    case NODEWORDS_TYPE_DEFAULT:
    case NODEWORDS_TYPE_PAGE:
      $token_types[] = 'node';
      $token_types[] = 'taxonomy';
      $token_types[] = 'vocabulary';
      $token_types[] = 'user';
      break;
    case NODEWORDS_TYPE_CONTENT_TYPE:
    case NODEWORDS_TYPE_NODE:
      $token_types[] = 'node';
      break;
    case NODEWORDS_TYPE_TERM:
      $token_types[] = 'taxonomy';
      break;
    case NODEWORDS_TYPE_VOCABULARY:
      $token_types[] = 'vocabulary';
      break;
    case NODEWORDS_TYPE_USER:
      $token_types[] = 'user';
      break;
  }
  $form['token_help'] = array(
    '#title' => t('Replacement patterns'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Use the raw versions of tokens to avoid problems with HTML entities.'),
  );
  $form['token_help']['help'] = array(
    '#value' => theme('token_tree', $token_types),
  );
}