You are here

function book_token_info in Token 8

Same name and namespace in other branches
  1. 7 token.tokens.inc \book_token_info()

Implements hook_token_info() on behalf of book.module.

File

./token.tokens.inc, line 1179
Token callbacks for the token module.

Code

function book_token_info() {
  $info['types']['book'] = [
    'name' => t('Book'),
    'description' => t('Tokens related to books.'),
    'needs-data' => 'book',
  ];
  $info['tokens']['book']['title'] = [
    'name' => t('Title'),
    'description' => t('Title of the book.'),
  ];
  $info['tokens']['book']['author'] = [
    'name' => t('Author'),
    'description' => t('The author of the book.'),
    'type' => 'user',
  ];
  $info['tokens']['book']['root'] = [
    'name' => t('Root'),
    'description' => t('Top level of the book.'),
    'type' => 'node',
  ];
  $info['tokens']['book']['parent'] = [
    'name' => t('Parent'),
    'description' => t('Parent of the current page.'),
    'type' => 'node',
  ];
  $info['tokens']['book']['parents'] = [
    'name' => t('Parents'),
    'description' => t("An array of all the node's parents, starting with the root."),
    'type' => 'array',
  ];
  $info['tokens']['node']['book'] = [
    'name' => t('Book'),
    'description' => t('The book page associated with the node.'),
    'type' => 'book',
  ];
  return $info;
}