function ctools_context_handler_get_render_handler

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

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;
}