function ctools_context_handler_set_access_restrictions

Set any access restrictions on the contexts for a handler.

Both the task and the handler could add restrictions to the contexts based upon the access control. These restrictions might be useful to limit what kind of content appears in the add content dialog; for example, if we have an access item that limits a node context to only 'story' and 'page' types, there is no need for content that only applies to the 'poll' type to appear.

1 call to ctools_context_handler_set_access_restrictions()
ctools_context_handler_get_all_contexts in includes/context-task-handler.inc
Load the contexts for a task and task handler together.

File

includes/context-task-handler.inc, line 442

Code

function ctools_context_handler_set_access_restrictions($task, $subtask, $handler, &$contexts) {
    // First, for the task:
    if ($function = ctools_plugin_get_function($task, 'access restrictions')) {
        $function($task, $subtask, $contexts);
    }
    // Then for the handler:
    if (isset($handler->conf['access'])) {
        ctools_access_add_restrictions($handler->conf['access'], $contexts);
    }
}