You are here

function nodewords_add_tokens_help in Nodewords: D6 Meta Tags 6.3

Same name and namespace in other branches
  1. 6.2 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 255
Implement an version that other modules can use to add meta tags.

Code

function nodewords_add_tokens_help(&$form, $type) {
  switch ($type['type']) {
    case NODEWORDS_TYPE_ERRORPAGE:
    case NODEWORDS_TYPE_PAGE:
      $tokens_type[] = 'global';
      $tokens_type[] = 'global meta tags';
      break;
    case NODEWORDS_TYPE_DEFAULT:
      $tokens_type[] = 'global';
      $tokens_type[] = 'global meta tags';
      $tokens_type[] = 'node';
      $tokens_type[] = 'node meta tags';
      $tokens_type[] = 'taxonomy';
      $tokens_type[] = 'user';
      break;
    case NODEWORDS_TYPE_CONTENT_TYPE:
    case NODEWORDS_TYPE_NODE:
      $tokens_type[] = 'global';
      $tokens_type[] = 'global meta tags';
      $tokens_type[] = 'node';
      $tokens_type[] = 'node meta tags';
      break;
    case NODEWORDS_TYPE_TERM:
    case NODEWORDS_TYPE_VOCABULARY:
      $tokens_type[] = 'global';
      $tokens_type[] = 'global meta tags';
      $tokens_type[] = 'taxonomy';
      break;
    case NODEWORDS_TYPE_USER:
      $tokens_type[] = 'global';
      $tokens_type[] = 'global meta tags';
      $tokens_type[] = 'user';
      break;
    default:
      $tokens_type = '';
  }
  if ($tokens_type) {
    $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(
      '#value' => theme('token_help', $tokens_type),
    );
  }
}