You are here

function filehash_token_info in File Hash 7

Same name and namespace in other branches
  1. 8 filehash.tokens.inc \filehash_token_info()

Implements hook_token_info().

File

./filehash.tokens.inc, line 11
Tokens for File Hash module.

Code

function filehash_token_info() {
  $info = array();
  $names = filehash_names();
  foreach (filehash_algos() as $algo) {
    $info['tokens']['file']["filehash-{$algo}"] = array(
      'name' => t('@algo hash', array(
        '@algo' => $names[$algo],
      )),
      'description' => t('The @algo hash of the file.', array(
        '@algo' => $names[$algo],
      )),
    );
    $info['tokens']['file']["filehash-{$algo}-pair-1"] = array(
      'name' => t('@algo hash: Initial pair', array(
        '@algo' => $names[$algo],
      )),
      'description' => t('The @algo hash of the file: first and second characters.', array(
        '@algo' => $names[$algo],
      )),
    );
    $info['tokens']['file']["filehash-{$algo}-pair-2"] = array(
      'name' => t('@algo hash: Second pair', array(
        '@algo' => $names[$algo],
      )),
      'description' => t('The @algo hash of the file: third and fourth characters.', array(
        '@algo' => $names[$algo],
      )),
    );
  }
  return $info;
}