You are here

function ctools_access_group_summary in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/context.inc \ctools_access_group_summary()

Get a summary of a group of access plugin's settings.

Parameters

$access: An array of settings theoretically set by the user, including the array of plugins to check:

  • 'plugins': the array of plugin metadata info to check
  • 'logic': (optional) either 'and' or 'or', indicating how to combine restrictions. Defaults to 'or'.

array $contexts: An array of zero or more contexts that may be used to determine if the user has access.

Return value

string The summary text. Can be NULL if there are no plugins defined.

3 calls to ctools_access_group_summary()
page_manager_handler_rearrange in page_manager/page_manager.admin.inc
Rearrange the order of variants.
page_manager_http_response_admin_summary in page_manager/plugins/task_handlers/http_response.inc
page_manager_page_admin_summary in page_manager/plugins/tasks/page.inc
Provide a nice administrative summary of the page so an admin can see at a glance what this page does and how it is configured.

File

includes/context.inc, line 1909
Contains code related to the ctools system of 'context'.

Code

function ctools_access_group_summary($access, $contexts) {
  if (empty($access['plugins']) || !is_array($access['plugins'])) {
    return NULL;
  }
  $descriptions = array();
  foreach ($access['plugins'] as $id => $test) {
    $plugin = ctools_get_access_plugin($test['name']);
    $descriptions[] = ctools_access_summary($plugin, $contexts, $test);
  }
  $separator = isset($access['logic']) && $access['logic'] === 'and' ? t(', and ') : t(', or ');
  return implode($separator, $descriptions);
}