function ctools_context_get_context_from_relationships in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/context.inc \ctools_context_get_context_from_relationships()
Fetch all active relationships
Parameters
$relationships: An keyed array of relationship data including:
- name: name of relationship
- context: context id relationship belongs to. This will be used to identify which context in the $contexts array to use to create the relationship context.
$contexts: A keyed array of contexts used to figure out which relationships are relevant. New contexts will be added to this.
$placeholders: If TRUE, placeholders are acceptable.
1 call to ctools_context_get_context_from_relationships()
- ctools_context_load_contexts in includes/
context.inc - Load a full array of contexts for an object.
File
- includes/
context.inc, line 944 - Contains code related to the ctools system of 'context'.
Code
function ctools_context_get_context_from_relationships($relationships, &$contexts, $placeholders = FALSE) {
$return = array();
foreach ($relationships as $rdata) {
if (!isset($rdata['context'])) {
continue;
}
if (is_array($rdata['context'])) {
$rcontexts = array();
foreach ($rdata['context'] as $cid) {
if (empty($contexts[$cid])) {
continue 2;
}
$rcontexts[] = $contexts[$cid];
}
}
else {
if (empty($contexts[$rdata['context']])) {
continue;
}
$rcontexts = $contexts[$rdata['context']];
}
$cid = ctools_context_id($rdata, 'relationship');
if ($context = ctools_context_get_context_from_relationship($rdata, $rcontexts)) {
$contexts[$cid] = $context;
}
}
}