You are here

function spaces_og_token_values in Spaces 6.2

Implementation of hook_token_values().

File

spaces_og/spaces_og.module, line 1130

Code

function spaces_og_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node' && (property_exists($object, 'og_groups') || property_exists($object, 'spaces_og'))) {
    $node = $object;
    if (property_exists($node, 'spaces_og')) {
      $gid = $node->spaces_og['gid'];
    }
    elseif (property_exists($object, 'og_groups')) {
      $gid = current($node->og_groups);
    }
    $space = spaces_load('og', $gid);
    $tokens['space-og-path'] = check_plain($space->purl);
    $tokens['space-og-path-raw'] = $space->purl;
    return $tokens;
  }
  else {
    return array(
      'space-og-path' => '',
      'space-og-path-raw' => '',
    );
  }
}