You are here

function ctools_get_relevant_access_plugins in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 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.

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 1325
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;
}