You are here

function access_handler_info in Access Control Kit 7

Returns information on available object access handlers.

Parameters

string $handler: (optional) The name of a handler class.

Return value

array|false The information array for the requested $handler, or FALSE if not found. If $handler is omitted, returns information for all available handlers in an array indexed by handler name. Handler information is returned as an associative array with the following keys:

  • label: The human-readable name of this handler.
  • scheme types: An array listing the scheme types that this handler supports, as defined in hook_access_scheme_info().
  • object types: An array listing the object types that this handler supports, as defined in hook_access_info(). A value of 'fieldable entity' indicates that the handler supports all object types that are fieldable entities, as defined by hook_entity_info().
  • class: The name of the handler class.
  • module: The module that provides the handler class.

See also

hook_access_handler_info()

hook_access_handler_info_alter()

7 calls to access_handler_info()
AccessPluginTest::testHanderInfo in ./access.test
Check that handlers are defined correctly.
AccessSchemeEntityController::save in ./access_scheme_entity_controller.inc
Saves an access scheme to the database.
access_info in ./access.module
Returns information on available access-controlled object types.
access_scheme_features_export in ./access.features.inc
Implements hook_features_export().
access_scheme_features_export_render in ./access.features.inc
Implements hook_features_export_render().

... See full list

2 string references to 'access_handler_info'
access_hook_info in ./access.module
Implements hook_hook_info().
access_info_cache_clear in ./access.module
Clears cached ACK API information.

File

./access.module, line 629
The access control kit module.

Code

function access_handler_info($handler = NULL) {
  $info =& drupal_static(__FUNCTION__, array());
  if (empty($info)) {
    $cache = cache_get('access_handler_info');
    if ($cache) {
      $info = $cache->data;
    }
    else {
      foreach (module_implements('access_handler_info') as $module) {
        $module_info = module_invoke($module, 'access_handler_info');
        if ($module_info) {
          foreach ($module_info as $handler_name => $handler_info) {

            // Merge in default values.
            $handler_info += array(
              'label' => '',
              'scheme types' => array(),
              'object types' => array(),
            );

            // Set inferred values.
            $handler_info['class'] = $handler_name;
            $handler_info['module'] = $module;
            $info[$handler_name] = $handler_info;
          }
        }
      }
      drupal_alter('access_handler_info', $info);
      cache_set('access_handler_info', $info);
    }
  }
  if (isset($handler)) {
    return isset($info[$handler]) ? $info[$handler] : FALSE;
  }
  return $info;
}