function oa_section_get_section_context in Open Atrium Core 7.2
Determines the current section id value
3 calls to oa_section_get_section_context()
- oa_core_get_section_context in includes/
oa_core.util.inc - Returns the current section id context
- oa_section_context_get_properties in modules/
oa_section_context/ oa_section_context.module - Property getter callback.
- oa_section_context_init in modules/
oa_section_context/ oa_section_context.module - Implements hook_init Put the section context into session variable
File
- modules/
oa_section_context/ oa_section_context.module, line 16 - Provides hook implementations and functionality for oa_section_context.
Code
function oa_section_get_section_context() {
$menu = menu_get_object();
if (!isset($menu->nid) || !($node = node_load($menu->nid))) {
// not a node page
// so only return SESSION if it's already set
return isset($_SESSION[OA_SESSION_SECTION]) ? $_SESSION[OA_SESSION_SECTION] : 0;
}
$set_session = 0;
if ($node->type == 'oa_section') {
// get section id directly from section nodes
$set_session = $node->nid;
}
elseif (isset($node->{OA_SECTION_FIELD}[LANGUAGE_NONE][0]['target_id'])) {
// otherwise get section id from any section field reference
$set_session = $node->{OA_SECTION_FIELD}[LANGUAGE_NONE][0]['target_id'];
}
return $set_session;
}