token

function modulename_tokentest() {
  $text = 'simple text with [token-use1] , [token-use2]';
  $node = node_load(123);
  $token2 = node_load(234);
  $text = token_replace_multiple($text, array('node' => $node , 'token2' => $token2));
  dsm($text); //output : simple text with 123 , 234
}
 
function modulename_token_list($type) {
  $tokens = array();
  if ($type == 'node') {
    $tokens['node'] = array(
      'token-use1' => t('token description here.'),
    );
  }
}
function module_token_values($type = 'all', $object = NULL) {
  if ($type == 'node') {
    $values['token-use1'] = $object->nid; // $object->nid = 123
  }
  elseif ($type == 'token2') {
    $values['token-use2'] = $object->nid; // $object->nid = 234
  }
  return $values;
}
Help Share this Article