function ctools_context_get_relevant_relationships in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/context.inc \ctools_context_get_relevant_relationships()
Fetch all relevant relationships.
Relevant relationships are any relationship that can be created based upon the list of existing contexts. For example, the 'node author' relationship is relevant if there is a 'node' context, but makes no sense if there is not one.
Parameters
$contexts: An array of contexts used to figure out which relationships are relevant.
Return value
An array of relationship keys that are relevant for the given set of contexts.
2 calls to ctools_context_get_relevant_relationships()
- ctools_context_add_relationship_form in includes/
context-admin.inc - ctools_context_ajax_item_add in includes/
context-admin.inc - Ajax entry point to add an context
File
- includes/
context.inc, line 912 - Contains code related to the ctools system of 'context'.
Code
function ctools_context_get_relevant_relationships($contexts) {
$relevant = array();
$relationships = ctools_get_relationships();
// Go through each relationship
foreach ($relationships as $rid => $relationship) {
// For each relationship, see if there is a context that satisfies it.
if (ctools_context_filter($contexts, $relationship['required context'])) {
$relevant[$rid] = $relationship['title'];
}
}
return $relevant;
}