You are here

function og_node_from_group_context in Organic groups 7

Return a new context based on an existing context.

1 string reference to 'og_node_from_group_context'
og_node_from_group.inc in plugins/relationships/og_node_from_group.inc
Plugin to provide an relationship handler for node from OG gorup.

File

plugins/relationships/og_node_from_group.inc, line 23
Plugin to provide an relationship handler for node from OG gorup.

Code

function og_node_from_group_context($context, $conf) {

  // If unset it wants a generic, unfilled context, which is just NULL.
  if (empty($context->data) || !isset($context->data->gid)) {
    return ctools_context_create_empty('node', NULL);
  }
  if (isset($context->data->gid) && $context->data->entity_type == 'node') {
    $group = $context->data;
    if ($node = $group
      ->getEntity()) {

      // Send it to ctools.
      return ctools_context_create('node', $node);
    }
  }
}