You are here

function draggableviews_discover_handlers in DraggableViews 7

Same name and namespace in other branches
  1. 6.3 draggableviews.module \draggableviews_discover_handlers()

Discover All Implementations For Draggableviews

Parameters

$filter_handler: The handler to return.

Return value

Either the entire array with all handlers or the specified handler entry.

2 calls to draggableviews_discover_handlers()
draggableviews_get_handlers_list in ./draggableviews.module
Get Handlers List
_draggableviews_init_handler in ./draggableviews.inc
Get Handler Instance

File

./draggableviews.module, line 528
Draggableviews module provides a style plugin for views. With this plugin rows become draggable and can be organized in complex structures.

Code

function draggableviews_discover_handlers($filter_handler = NULL) {

  // @todo there's no cache functionality implemented yet.
  $cache = array();

  // Get implementation definitions from all modules.
  foreach (module_implements('draggableviews_handlers') as $module) {
    $function = $module . '_draggableviews_handlers';
    $result = $function();
    if (!is_array($result)) {
      continue;
    }
    $path = drupal_get_path('module', $module);
    foreach ($result as $handler => $def) {
      if (!isset($def['path'])) {
        $def['path'] = $path;
      }
      if (!isset($def['file'])) {
        $def['file'] = "{$handler}.inc";
      }
      if (!isset($def['handler'])) {
        $def['handler'] = 'draggableviews_handler_' . $handler;
      }

      // Merge the new data.
      $cache[$handler] = $def;
    }
  }
  if (isset($filter_handler)) {
    if (isset($cache[$filter_handler])) {
      return $cache[$filter_handler];
    }
    else {
      return FALSE;
    }
  }
  return $cache;
}