function views_discover_handlers

2.x handlers.inc views_discover_handlers()

Builds and return a list of all handlers available in the system.

Return value

Nested array of handlers

1 call to views_discover_handlers()
views_fetch_handler_data in includes/handlers.inc
Fetch the handler data from cache.

File

includes/handlers.inc, line 132
handlers.inc Defines the various handler objects to help build and display views.

Code

function views_discover_handlers() {
  $cache = array();
  // Get handlers from all modules.
  foreach (module_implements('views_handlers') as $module) {
    $function = $module . '_views_handlers';
    $result = $function();
    if (!is_array($result)) {
      continue;
    }

    $module_dir = isset($result['info']['module']) ? $result['info']['module'] : $module;
    $path = isset($result['info']['path']) ? $result['info']['path'] : drupal_get_path('module', $module_dir);

    foreach ($result['handlers'] as $handler => $def) {
      if (!isset($def['module'])) {
        $def['module'] = $module_dir;
      }
      if (!isset($def['path'])) {
        $def['path'] = $path;
      }
      if (!isset($def['file'])) {
        $def['file'] = "$handler.inc";
      }
      if (!isset($def['handler'])) {
        $def['handler'] = $handler;
      }
      // merge the new data in
      $cache[$handler] = $def;
    }
  }
  return $cache;
}