You are here

function content_multigroup_token_list in Custom Formatters 6

Implements hook_token_list().

File

includes/content_multigroup.inc, line 104
Provides Custom Formatters integration with the Content Multigroup module.

Code

function content_multigroup_token_list($type = 'all') {
  $tokens = array(
    'content_multigroup' => array(),
  );
  foreach (fieldgroup_groups() as $groups) {
    foreach ($groups as $group) {
      if ($group['group_type'] == 'multigroup') {
        foreach ($group['fields'] as $field) {
          if (function_exists($function = "{$field['widget_module']}_token_list")) {
            foreach ($function('field') as $token) {
              foreach ($token as $key => $value) {
                $tokens['content_multigroup']["content_multigroup-{$field['field_name']}-{$key}"] = $value;
              }
            }
          }
        }
      }
    }
  }
  return $tokens;
}