You are here

function panels_relationship_get_context in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/plugins.inc \panels_relationship_get_context()

Fetch a context from a relationship, given the context input.

1 call to panels_relationship_get_context()
panels_relationship_get_contexts in includes/plugins.inc
Fetch all active relationships

File

includes/plugins.inc, line 937
plugins.inc

Code

function panels_relationship_get_context($relationship, $arg) {
  if ($function = panels_plugin_get_function('relationships', $relationship['name'], 'context')) {
    if (!isset($relationship['relationship_settings'])) {
      $relationship['relationship_settings'] = array();
    }
    $context = $function($arg, $relationship['relationship_settings']);
    if ($context) {
      $context->identifier = $relationship['identifier'];
      $context->page_title = isset($relationship['title']) ? $relationship['title'] : '';
      $context->keyword = $relationship['keyword'];
      return $context;
    }
  }
}