function ctools_get_relevant_access_plugins in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/context.inc \ctools_get_relevant_access_plugins()
Fetch a list of access plugins that are available for a given list of contexts.
If 'logged-in-user' is not in the list of contexts, it will be added as this is required.
Parameters
array $contexts: Array of ctools_context objects with which to select access plugins.
Return value
array Array of applicable access plugins. Can be empty.
1 call to ctools_get_relevant_access_plugins()
- ctools_access_admin_form in includes/
context-access-admin.inc - Administrative form for access control.
File
- includes/
context.inc, line 1836 - Contains code related to the ctools system of 'context'.
Code
function ctools_get_relevant_access_plugins($contexts) {
if (!isset($contexts['logged-in-user'])) {
$contexts['logged-in-user'] = ctools_access_get_loggedin_context();
}
$all_plugins = ctools_get_access_plugins();
$plugins = array();
foreach ($all_plugins as $id => $plugin) {
if (!empty($plugin['required context']) && !ctools_context_match_requirements($contexts, $plugin['required context'])) {
continue;
}
$plugins[$id] = $plugin;
}
return $plugins;
}