function domain_token_values in Domain Access 6.2
Implement hook_token_values().
File
- ./
domain.module, line 2756 - Core module functions for the Domain Access suite.
Code
function domain_token_values($type, $object = NULL, $options = array()) {
global $_domain;
if ($type != 'global') {
return;
}
$default_domain = domain_default(FALSE);
$subdomain_elements = explode('.', $_domain['subdomain']);
if (count($subdomain_elements) > 2) {
$subdomain = $subdomain_elements[0];
}
else {
$subdomain = 'www';
}
// Current domain tokens.
$tokens['domain-id'] = $_domain['domain_id'];
$tokens['domain-name'] = domain_url_encode($_domain['sitename']);
$tokens['domain-name-raw'] = check_plain($_domain['sitename']);
$tokens['domain-url'] = domain_url_encode($_domain['subdomain']);
$tokens['domain-url-raw'] = check_plain($_domain['subdomain']);
$tokens['domain-subdomain'] = domain_url_encode($subdomain);
$tokens['domain-subdomain-raw'] = check_plain($subdomain);
// Default domain
$tokens['domain-default-id'] = $default_domain['domain_id'];
$tokens['domain-default-name'] = domain_url_encode($default_domain['sitename']);
$tokens['domain-default-name-raw'] = check_plain($default_domain['sitename']);
$tokens['domain-default-url'] = domain_url_encode($default_domain['subdomain']);
$tokens['domain-default-url-raw'] = check_plain($default_domain['subdomain']);
return $tokens;
}