You are here

function spaces_og_spaces_get_space_from_object in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 spaces_og/spaces_og.module \spaces_og_spaces_get_space_from_object()

Implementation of hook_spaces_get_space_from_object().

File

spaces_og/spaces_og.module, line 604

Code

function spaces_og_spaces_get_space_from_object($type, $object) {
  if ($type == 'node') {
    if (og_is_group_type('node', $object->type)) {
      return spaces_load('og', $object->nid);
    }
    else {
      if (og_is_group_content_type('node', $object->type)) {
        if (isset($object->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE][0]['gid'])) {
          return spaces_load('og', og_load($object->{OG_AUDIENCE_FIELD}[LANGUAGE_NONE][0]['gid'])->etid);
        }
      }
    }
  }
}