You are here

number.token.inc in Content Construction Kit (CCK) 6.2

Same filename and directory in other branches
  1. 6.3 modules/number/number.token.inc

Provides tokens for number fields.

File

modules/number/number.token.inc
View source
<?php

/**
 * @file
 * Provides tokens for number fields.
 */

/**
 * Implementation of hook_token_list().
 */
function number_token_list($type = 'all') {
  if ($type == 'field' || $type == 'all') {
    $tokens = array();
    $tokens['number']['raw'] = t('Raw number value');
    $tokens['number']['formatted'] = t('Formatted number value');
    return $tokens;
  }
}

/**
 * Implementation of hook_token_values().
 */
function number_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'field') {
    $item = $object[0];
    $tokens['raw'] = $item['value'];
    $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
    return $tokens;
  }
}

Functions

Namesort descending Description
number_token_list Implementation of hook_token_list().
number_token_values Implementation of hook_token_values().