You are here

function opigno_og_context_handler in Opigno 7

Determines the context from a url.

1 string reference to 'opigno_og_context_handler'
opigno_og_context_negotiation_info in ./opigno.module
Implements hook_og_context_negotiation_info

File

./opigno.module, line 377
Contains all hook_implementations and module specific API.

Code

function opigno_og_context_handler() {
  if (preg_match('/^node\\/[0-9]+\\/./', current_path())) {
    if (og_is_group('node', node_load(arg(1)))) {
      return array(
        'node' => array(
          arg(1),
        ),
      );
    }
  }
  elseif (preg_match('/^entityreference\\/autocomplete\\/single/', current_path())) {
    if (is_numeric(arg(6))) {
      $node = node_load(6);
      if (isset($node->nid) && og_is_group('node', $node)) {
        return array(
          'node' => array(
            arg(6),
          ),
        );
      }
    }
  }
}