function rrssb_tokens in Ridiculously Responsive Social Sharing Buttons 7
Same name and namespace in other branches
- 8.2 rrssb.module \rrssb_tokens()
- 7.2 rrssb.module \rrssb_tokens()
Implements hook_tokens().
These tokens are not advertised in hook_token_info because they are of no use outside this module.
File
- ./
rrssb.module, line 55
Code
function rrssb_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
if ($type == 'rrssb' && !empty($data['rrssb'])) {
foreach ($tokens as $name => $original) {
if (isset($data['rrssb'][$name])) {
$replacements[$original] = $data['rrssb'][$name];
}
}
}
// This issue https://www.drupal.org/node/823780 has a patch to add site:logo.
// In the meantime, add our own version.
if ($type == 'rrssbsite') {
foreach ($tokens as $name => $original) {
switch ($name) {
case 'logo-url':
if ($uri = theme_get_setting('logo')) {
$replacements[$original] = $uri;
}
break;
}
}
}
return $replacements;
}