You are here

function ctools_context_handler_get_render_handler in Chaos Tool Suite (ctools) 7

Figure out which of the listed handlers should be used to render.

1 call to ctools_context_handler_get_render_handler()
ctools_context_handler_render in includes/context-task-handler.inc
Render a context type task handler given a list of handlers attached to a type.

File

includes/context-task-handler.inc, line 54
Support for creating 'context' type task handlers.

Code

function ctools_context_handler_get_render_handler($task, $subtask, $handlers, $contexts, $args) {

  // Try each handler.
  foreach ($handlers as $id => $handler) {
    $plugin = page_manager_get_task_handler($handler->handler);

    // First, see if the handler has a tester.
    $function = ctools_plugin_get_function($plugin, 'test');
    if ($function) {
      $test = $function($handler, $contexts, $args);
      if ($test) {
        return $id;
      }
    }
    else {

      // If not, if it's a 'context' type handler, use the default tester.
      if ($plugin['handler type'] == 'context') {
        $test = ctools_context_handler_default_test($handler, $contexts, $args);
        if ($test) {
          return $id;
        }
      }
    }
  }
  return FALSE;
}