function page_manager_http_response_render

1 string reference to 'page_manager_http_response_render'
http_response.inc in page_manager/plugins/task_handlers/http_response.inc
This is the task handler plugin to handle generating 403, 404, 301 and 302 response codes.

File

page_manager/plugins/task_handlers/http_response.inc, line 299

Code

function page_manager_http_response_render($handler, $base_contexts, $args, $test = TRUE) {
    // Go through arguments and see if they match.
    ctools_include('context');
    ctools_include('context-task-handler');
    // Add my contexts.
    $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
    // Test.
    if ($test && !ctools_context_handler_select($handler, $contexts)) {
        return;
    }
    if (isset($handler->handler)) {
        ctools_context_handler_pre_render($handler, $contexts, $args);
    }
    $info['response code'] = $handler->conf['code'];
    if ($info['response code'] == 301 || $info['response code'] == 302) {
        $path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts);
        $url = parse_url($path);
        if (isset($url['query'])) {
            $path = strtr($path, array(
                '?' . $url['query'] => '',
            ));
            $info['query'] = drupal_get_query_array($url['query']);
        }
        if (isset($url['fragment'])) {
            $path = strtr($path, array(
                '#' . $url['fragment'] => '',
            ));
            $info['fragment'] = $url['fragment'];
        }
        $info['destination'] = rtrim($path, '?');
    }
    return $info;
}