You are here

function relation_token_info in Relation 7

Same name and namespace in other branches
  1. 8.2 relation.tokens.inc \relation_token_info()
  2. 8 relation.tokens.inc \relation_token_info()

Implements hook_token_info().

File

./relation.tokens.inc, line 11
Builds placeholder replacement tokens for relation data.

Code

function relation_token_info() {
  $type = array(
    'name' => t('Relation'),
    'description' => t('Tokens related to individual relations.'),
    'needs-data' => 'relation',
  );

  // Core tokens for relations.
  $relation['rid'] = array(
    'name' => t("Relation ID"),
    'description' => t('The unique ID of the relation.'),
  );
  $relation['vid'] = array(
    'name' => t("Revision ID"),
    'description' => t("The unique ID of the relation's latest revision."),
  );
  $relation['relation_type'] = array(
    'name' => t("Relation type"),
    'description' => t("The type of the relation."),
  );
  $relation['relation_type_label'] = array(
    'name' => t("Relation type label"),
    'description' => t("The human-readable name of the relation type."),
  );

  //   $relation['title'] = array(
  //     'name' => t("Title"),
  //     'description' => t("The title of the relation."),
  //   );
  $relation['url'] = array(
    'name' => t("URL"),
    'description' => t("The URL of the relation."),
  );
  $relation['edit-url'] = array(
    'name' => t("Edit URL"),
    'description' => t("The URL of the relation's edit page."),
  );

  // Chained tokens for relations.
  $relation['created'] = array(
    'name' => t("Date created"),
    'description' => t("The date the relation was created."),
    'type' => 'date',
  );
  $relation['changed'] = array(
    'name' => t("Date changed"),
    'description' => t("The date the relation was most recently updated."),
    'type' => 'date',
  );
  $relation['author'] = array(
    'name' => t("Author"),
    'description' => t("The author of the relation."),
    'type' => 'user',
  );
  return array(
    'types' => array(
      'relation' => $type,
    ),
    'tokens' => array(
      'relation' => $relation,
    ),
  );
}