You are here

function opigno_context_tokens in Opigno 7.0

Implements hook_tokens()

File

modules/opigno_context/opigno_context.module, line 175
Contains all hook_implementations and module specific API.

Code

function opigno_context_tokens($type, $tokens, $data = array(), $options = array()) {
  $replacements = array();
  if ($type == 'node' && !empty($data['node']) && !empty($data['node']->group_audience[LANGUAGE_NONE][0]['gid'])) {
    $node = $data['node'];
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'group-audience-gid':
          $replacements[$original] = $data['node']->group_audience[LANGUAGE_NONE][0]['gid'];
          break;
      }
    }
  }
  return $replacements;
}