function panels_panel_context_admin_summary in Panels 7.3
Same name and namespace in other branches
- 6.3 plugins/task_handlers/panel_context.inc \panels_panel_context_admin_summary()
Provide a nice little summary of what's in a panel.
The task handler manager provides a summary of a given handler in a collapsible div. This callback provides that. For a Panel, we provide a summary of the layout type and content on one side, and a summary of the contexts in use on the other.
1 string reference to 'panels_panel_context_admin_summary'
- panel_context.inc in plugins/
task_handlers/ panel_context.inc - This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.
File
- plugins/
task_handlers/ panel_context.inc, line 445 - This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.
Code
function panels_panel_context_admin_summary($handler, $task, $subtask, $page, $show_title = TRUE) {
$task_name = page_manager_make_task_name($task['name'], $subtask['name']);
$output = '';
$display = panels_panel_context_get_display($handler);
ctools_include('plugins', 'panels');
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);
$layout = panels_get_layout($display->layout);
$plugin = page_manager_get_task_handler($handler->handler);
$object = ctools_context_handler_get_task_object($task, $subtask, $handler);
$display->context = ctools_context_load_contexts($object, TRUE);
$access = ctools_access_group_summary(!empty($handler->conf['access']) ? $handler->conf['access'] : array(), $display->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' => t('page-summary-label'),
'data' => t('Storage'),
),
array(
'class' => t('page-summary-data'),
'data' => $type,
),
array(
'class' => t('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' => t('page-summary-label'),
'data' => t('Status'),
),
array(
'class' => t('page-summary-data'),
'data' => $text,
),
array(
'class' => t('page-summary-operation'),
'data' => $link,
),
);
$link = l(t('Edit'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'criteria',
)));
$rows[] = array(
array(
'class' => t('page-summary-label'),
'data' => t('Selection rule'),
),
array(
'class' => t('page-summary-data'),
'data' => $access,
),
array(
'class' => t('page-summary-operation'),
'data' => $link,
),
);
$link = l(t('Change layout'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'layout',
)));
$link .= '<br />' . l(t('Edit content'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'content',
)));
$link .= '<br />' . l(t('Preview'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'preview',
)));
$rows[] = array(
array(
'class' => t('page-summary-label'),
'data' => t('Layout'),
),
array(
'class' => t('page-summary-data'),
'data' => check_plain($layout['title']),
),
array(
'class' => t('page-summary-operation'),
'data' => $link,
),
);
$content_link = ' [' . l(t('Edit'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'content',
))) . ']';
$context_link = ' [' . l(t('Edit'), page_manager_edit_url($task_name, array(
'handlers',
$handler->name,
'context',
))) . ']';
$info = theme('table', array(
'rows' => $rows,
'attributes' => array(
'class' => '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>';
/*
$output .= '<div class="right-container">';
$output .= '<h3 class="context-title">' . t('Contexts') . $context_link . '</h3>';
$output .= $contexts;
$output .= '</div>';
$output .= '<div class="left-container">';
// $output .= $icon;
$output .= '<h3 class="handler-title">' . t('Content') . $content_link . '</h3>';
$output .= $content;
$output .= '</div>';
*/
return $output;
}