function statistics_token_info

Same name and namespace in other branches
  1. 7.x modules/statistics/statistics.tokens.inc \statistics_token_info()
  2. 9 core/modules/statistics/statistics.tokens.inc \statistics_token_info()
  3. 8.9.x core/modules/statistics/statistics.tokens.inc \statistics_token_info()
  4. 10 core/modules/statistics/statistics.tokens.inc \statistics_token_info()

Implements hook_token_info().

File

core/modules/statistics/statistics.tokens.inc, line 13

Code

function statistics_token_info() {
    $node['total-count'] = [
        'name' => t("Number of views"),
        'description' => t("The number of visitors who have read the node."),
    ];
    $node['day-count'] = [
        'name' => t("Views today"),
        'description' => t("The number of visitors who have read the node today."),
    ];
    $node['last-view'] = [
        'name' => t("Last view"),
        'description' => t("The date on which a visitor last read the node."),
        'type' => 'date',
    ];
    return [
        'tokens' => [
            'node' => $node,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.