function views_token_info

Same name in other branches
  1. 8.9.x core/modules/views/views.tokens.inc \views_token_info()
  2. 10 core/modules/views/views.tokens.inc \views_token_info()
  3. 11.x core/modules/views/views.tokens.inc \views_token_info()

Implements hook_token_info().

File

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

Code

function views_token_info() {
    $info['types']['view'] = [
        'name' => t('View', [], [
            'context' => 'View entity type',
        ]),
        'description' => t('Tokens related to views.'),
        'needs-data' => 'view',
    ];
    $info['tokens']['view']['label'] = [
        'name' => t('Label'),
        'description' => t('The label of the view.'),
    ];
    $info['tokens']['view']['description'] = [
        'name' => t('Description'),
        'description' => t('The description of the view.'),
    ];
    $info['tokens']['view']['id'] = [
        'name' => t('ID'),
        'description' => t('The machine-readable ID of the view.'),
    ];
    $info['tokens']['view']['title'] = [
        'name' => t('Title'),
        'description' => t('The title of current display of the view.'),
    ];
    $info['tokens']['view']['url'] = [
        'name' => t('URL'),
        'description' => t('The URL of the view.'),
        'type' => 'url',
    ];
    $info['tokens']['view']['base-table'] = [
        'name' => t('Base table'),
        'description' => t('The base table used for this view.'),
    ];
    $info['tokens']['view']['base-field'] = [
        'name' => t('Base field'),
        'description' => t('The base field used for this view.'),
    ];
    $info['tokens']['view']['total-rows'] = [
        'name' => t('Total rows'),
        'description' => t('The total amount of results returned from the view. The current display will be used.'),
    ];
    $info['tokens']['view']['items-per-page'] = [
        'name' => t('Items per page'),
        'description' => t('The number of items per page.'),
    ];
    $info['tokens']['view']['current-page'] = [
        'name' => t('Current page'),
        'description' => t('The current page of results the view is on.'),
    ];
    $info['tokens']['view']['page-count'] = [
        'name' => t('Page count'),
        'description' => t('The total page count.'),
    ];
    return $info;
}

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