Token Functions

Categories

Component ID

1224692

Component name

Token Functions

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

546

Component created

Component changed

Component body

The basic idea is that when one defines the token they add an addition param of function which is a callback to be used.

  $info['tokens']['f']['cap'] = array(            
    'name' => t('Capitalize'),                
    'description' => t("Capitalizes the value. ") . token_function_help(1), 
    'dynamic' => TRUE,                                            
    'function' => 'strtoupper',      
  );   

so cap would take what ever the X in [f:cap:X] and capitalize it.
one can use multiple params separated by :
and one can use tokens but they need to be wrapped in {} instead of []