function panels_relationship_get_contexts in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/plugins.inc \panels_relationship_get_contexts()
Fetch all active relationships
Parameters
$relationships: An keyed array of relationship data including:
- name: name of relationship
- context: context id relationship belongs to.
$contexts: A keyed array of contexts used to figure out which relationships are relevant. New contexts will be added to this.
1 call to panels_relationship_get_contexts()
- panels_context_load_contexts in includes/
plugins.inc - Get a group of empty contexts for the object; this assumes all the standard context types, and doesn't punish you if they aren't available.
File
- includes/
plugins.inc, line 903 - plugins.inc
Code
function panels_relationship_get_contexts($relationships, &$contexts) {
$return = array();
foreach ($relationships as $rdata) {
if (empty($contexts[$rdata['context']])) {
continue;
}
$relationship = panels_get_relationship($rdata['name']);
// If the relationship can't be found or its context can't be found,
// ignore.
if (!$relationship) {
continue;
}
$cid = panels_relationship_context_id($rdata);
if ($context = panels_relationship_get_context($rdata, $contexts[$rdata['context']])) {
$contexts[$cid] = $context;
}
}
}