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.

Comments

narcisgirona’s picture

Hi guys!

Question:

I wanna "print" [node:field_term_x] or [node:field_term_y] depending on the [node:content_type].

The problem is that i don't know how to implement it! :(

Could anyone help me to translate this to php language please?

if [node:content_type] = "page";

"print" [node:field_term_x];

THANKS!!

doors’s picture

I need to use imagecache tokens in some rules.

Can this be done with this module and can an example be given?