function copyright_block_tokens in Copyright Block module 7.2
Same name and namespace in other branches
- 8 copyright_block.module \copyright_block_tokens()
Implements hook_tokens().
File
- ./
copyright_block.module, line 149 - Creates a dynamic copyright information block.
Code
function copyright_block_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
if ($type == 'copyright_statement') {
$separator = check_plain(variable_get('copyright_block_separator', '-'));
foreach ($tokens as $name => $original) {
switch ($name) {
case 'dates':
$start_year = variable_get('copyright_block_start_year', date('Y'));
$current_year = date('Y');
$replacements[$original] = $start_year < $current_year ? $start_year . $separator . $current_year : $start_year;
break;
}
}
}
return $replacements;
}