function page_manager_http_response_admin_summary

1 string reference to 'page_manager_http_response_admin_summary'
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 116

Code

function page_manager_http_response_admin_summary($handler, $task, $subtask, $page, $show_title = TRUE) {
    $task_name = page_manager_make_task_name($task['name'], $subtask['name']);
    $output = '';
    ctools_include('context');
    ctools_include('context-task-handler');
    // Get the operations.
    $operations = page_manager_get_operations($page);
    // Get operations for just this handler.
    $operations = $operations['handlers']['children'][$handler->name]['children']['actions']['children'];
    $args = array(
        'handlers',
        $handler->name,
        'actions',
    );
    $rendered_operations = page_manager_render_operations($page, $operations, array(), array(
        'class' => array(
            'actions',
        ),
    ), 'actions', $args);
    $plugin = page_manager_get_task_handler($handler->handler);
    $object = ctools_context_handler_get_task_object($task, $subtask, $handler);
    $context = ctools_context_load_contexts($object, TRUE);
    $access = ctools_access_group_summary(!empty($handler->conf['access']) ? $handler->conf['access'] : array(), $context);
    if ($access) {
        $access = t('This panel will be selected if @conditions.', array(
            '@conditions' => $access,
        ));
    }
    else {
        $access = t('This panel will always be selected.');
    }
    $rows = array();
    $type = $handler->type == t('Default') ? t('In code') : $handler->type;
    $rows[] = array(
        array(
            'class' => array(
                'page-summary-label',
            ),
            'data' => t('Storage'),
        ),
        array(
            'class' => array(
                'page-summary-data',
            ),
            'data' => $type,
        ),
        array(
            'class' => array(
                'page-summary-operation',
            ),
            'data' => '',
        ),
    );
    if (!empty($handler->disabled)) {
        $link = l(t('Enable'), page_manager_edit_url($task_name, array(
            'handlers',
            $handler->name,
            'actions',
            'enable',
        )));
        $text = t('Disabled');
    }
    else {
        $link = l(t('Disable'), page_manager_edit_url($task_name, array(
            'handlers',
            $handler->name,
            'actions',
            'disable',
        )));
        $text = t('Enabled');
    }
    $rows[] = array(
        array(
            'class' => array(
                'page-summary-label',
            ),
            'data' => t('Status'),
        ),
        array(
            'class' => array(
                'page-summary-data',
            ),
            'data' => $text,
        ),
        array(
            'class' => array(
                'page-summary-operation',
            ),
            'data' => $link,
        ),
    );
    $link = l(t('Edit'), page_manager_edit_url($task_name, array(
        'handlers',
        $handler->name,
        'criteria',
    )));
    $rows[] = array(
        array(
            'class' => array(
                'page-summary-label',
            ),
            'data' => t('Selection rule'),
        ),
        array(
            'class' => array(
                'page-summary-data',
            ),
            'data' => $access,
        ),
        array(
            'class' => array(
                'page-summary-operation',
            ),
            'data' => $link,
        ),
    );
    $link = l(t('Edit'), page_manager_edit_url($task_name, array(
        'handlers',
        $handler->name,
        'settings',
    )));
    $codes = page_manager_http_response_codes();
    $rows[] = array(
        array(
            'class' => array(
                'page-summary-label',
            ),
            'data' => t('Response code'),
        ),
        array(
            'class' => array(
                'page-summary-data',
            ),
            'data' => $codes[$handler->conf['code']],
        ),
        array(
            'class' => array(
                'page-summary-operation',
            ),
            'data' => $link,
        ),
    );
    $info = theme('table', array(
        'header' => array(),
        'rows' => $rows,
        'attributes' => array(
            'class' => array(
                'page-manager-handler-summary',
            ),
        ),
    ));
    $title = $handler->conf['title'];
    if ($title != t('Panel')) {
        $title = t('Panel: @title', array(
            '@title' => $title,
        ));
    }
    $output .= '<div class="clearfix">';
    if ($show_title) {
        $output .= '<div class="handler-title clearfix">';
        $output .= '<div class="actions handler-actions">' . $rendered_operations['actions'] . '</div>';
        $output .= '<span class="title-label">' . $title . '</span>';
    }
    $output .= '</div>';
    $output .= $info;
    $output .= '</div>';
    return $output;
}