You are here

function _token_upgrade_token_date_list in Token 7

Same name and namespace in other branches
  1. 8 token.install \_token_upgrade_token_date_list()

Build a list of Drupal 6 date tokens and their Drupal 7 token names.

1 call to _token_upgrade_token_date_list()
_token_upgrade_token_list in ./token.install
Build a list of Drupal 6 tokens and their Drupal 7 token names.

File

./token.install, line 180
Install, update and uninstall functions for the token module.

Code

function _token_upgrade_token_date_list($old_token, $new_token) {
  $tokens = array();
  $formats = array(
    'yyyy' => 'Y',
    'yy' => 'y',
    'month' => 'F',
    'mon' => 'M',
    'mm' => 'm',
    'm' => 'n',
    'ww' => 'W',
    'date' => 'N',
    'day' => 'l',
    'ddd' => 'D',
    'dd' => 'd',
    'd' => 'j',
  );
  foreach ($formats as $token_format => $date_format) {
    $tokens[$old_token . $token_format] = "{$new_token}:custom:{$date_format}";
  }
  $tokens[$old_token . 'raw'] = "{$new_token}:raw";
  $tokens[$old_token . 'since'] = "{$new_token}:since";
  return $tokens;
}