Very Basic Custom Token with Domain Access
Here is a simple way to create a custom token that you can use with Domain Access. In this case there are only 2 domains, but you could easily adapt this as many domains as you want. To find out what domain uses which domain id go to Admin > Structure > Domains
1. Go to Admin > Structure > Custom Token, click on Add Token
2. Enter a Token Name and Description
3. Choose "Custom Tokens" for the Token Type
4. In the PHP Replacement text area enter something like this:
global $_domain;
if ($_domain['domain_id'] == 1 ) {
$basic_token = 'Some text for domain one';
return $basic_token;
}
else {
$other_basic_token = 'Some text for domain two';
return $other_basic_token;
}
5. Hit "Save Token"
Back on the Custom Token main page you will now see your custom token outputted in the "demo" column. You can use this new token as an input filter if you have the Token Filter module installed.
The tokens will be [custom:basictoken] and [custom:otherbasictoken] respectively.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion