You are here

function pcp_token_info in Profile Complete Percent 7

Implements hook_token_info().

File

./pcp.tokens.inc, line 11
Builds replacement tokens for Profile Complete Percentage.

Code

function pcp_token_info() {
  $info = array();

  // Declare a token type. We could use 'pcp' instead of 'pcp-user', but maybe
  // some day we will add bundle tokens, and then we can use 'pcp-bundle' for
  // those.
  $info['types']['pcp-user'] = array(
    'name' => t('PCP user tokens'),
    'description' => t('Custom user tokens for the Profile Complete Percentage module.'),
  );

  // Declare tokens [pcp-user] and [pcp-profile2:?] that can be chained after
  // any token that provides a user object, such as [site:current-user].
  $info['tokens']['pcp-user']['pcp-user'] = array(
    'name' => t('Profile percent complete'),
    'description' => t("The user's core Profile Completed Percentage."),
    'needs-data' => 'user',
  );
  $info['tokens']['pcp-user']['pcp-profile2'] = array(
    'name' => t('Profile2 percent complete'),
    'description' => t("The user's Profile Completed Percentage for the profile type ?."),
    'needs-data' => 'user',
    'dynamic' => TRUE,
  );
  return $info;
}