The %element-title is using the following invalid tokens I have defined few tokens that are grouped in few separate groups similar to [node:content-type:name] scheme. For example I'd like to have a token like [master:sub_group_1:tokan_A]. So This is how hook_token_info() looks like:

function MY_MODULE_token_info() {
  $tokens = array();
  $types = array();

  $types['master'] = array(
    'name' =&gt; 'Master group',
    'description' =&gt; 'This is the master group',
  );

  $types['sub_group_1'] = array(
    'name' =&gt; 'Sub group 1',
    'description' =&gt; 'This is the first sub group',
    // this tells this group that it's parent is 'master' group.
    'needs-data' =&gt; 'master',
  );

  $tokens['sub_group_1']['token_A'] = array(
    'name' =&gt; 'Token A',
    'description' =&gt; 'This token prints letter A',
  );

  return array(
    'types' =&gt; $types,
    'tokens' =&gt; $tokens,
  );
}


I'll skip MY_MODULE_tokens() as it's irrelevant here, but token_replace() works perfectly. It replaces [master:sub_group_1:token_A] correctly. But the problem is that token module does not list my custom tokens in available tokens section and when I try to use [master:sub_group_1:token_A] in forms that get validated by token module, I get The %element-title is using the following invalid tokens error message.

What is the correct method to define custom tokens and group them to avoid conflicts with tokens defined by other modules?
It seems that in order to nest those tokens a "dummy" token is needed that matches group name:

function MY_MODULE_token_info() {
  $tokens = array();
  $types = array();

  $types['master'] = array(
    'name' =&gt; 'Master group',
    'description' =&gt; 'This is the master group',
  );

  // This is needed in order to nest tokens:
  // a dummy token that is the same as nested group/type
  $tokens['master']['sub_group_1'] = array(
    'name' =&gt; 'Sub group 1',
    'description' =&gt; '1st tokens group',
    'type' =&gt; 'sub_group_1',
  );

  $types['sub_group_1'] = array(
    'name' =&gt; 'Sub group 1',
    'description' =&gt; 'This is the first sub group',
    // this tells this group that it's parent is 'master' group.
    'needs-data' =&gt; 'master',
  );

  $tokens['sub_group_1']['token_A'] = array(
    'name' =&gt; 'Token A',
    'description' =&gt; 'This token prints letter A',
  );

  return array(
    'types' =&gt; $types,
    'tokens' =&gt; $tokens,
  );
}