function theme_ctools_context_list_no_table in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/context.theme.inc \theme_ctools_context_list_no_table()
ctools_context_list() but not in a table format because tabledrag won't let us have tables within tables and still drag.
File
- includes/
context.theme.inc, line 239 - Contains theme registry and theme implementations for the context tool.
Code
function theme_ctools_context_list_no_table($object) {
ctools_add_css('context');
$titles = array();
$output = '';
$count = 1;
// Describe 'built in' contexts.
if (!empty($object->base_contexts)) {
foreach ($object->base_contexts as $id => $context) {
$output .= '<div class="ctools-context-holder clear-block">';
$output .= '<div class="ctools-context-title">' . t('Built in context') . '</div>';
$desc = check_plain($context->identifier);
if (isset($context->keyword)) {
$desc .= '<div class="description">' . t('Keyword: %@keyword', array(
'@keyword' => $context->keyword,
)) . '</div>';
}
if (isset($context->description)) {
$desc .= '<div class="description">' . filter_xss_admin($context->description) . '</div>';
}
$output .= '<div class="ctools-context-content">' . $desc . '</div>';
$output .= '</div>';
$titles[$id] = $context->identifier;
$count++;
}
}
// First, make a list of arguments. Arguments are pretty simple.
if (!empty($object->arguments)) {
foreach ($object->arguments as $argument) {
$output .= '<div class="ctools-context-holder clear-block">';
$output .= '<div class="ctools-context-title">' . t('Argument @count', array(
'@count' => $count,
)) . '</div>';
$desc = check_plain($argument['identifier']);
if (isset($argument['keyword'])) {
$desc .= '<div class="description">' . t('Keyword: %@keyword', array(
'@keyword' => $argument['keyword'],
)) . '</div>';
}
$output .= '<div class="ctools-context-content">' . $desc . '</div>';
$output .= '</div>';
$titles[ctools_context_id($argument, 'argument')] = $argument['identifier'];
$count++;
}
}
$count = 1;
// Then, make a nice list of contexts.
if (!empty($object->contexts)) {
foreach ($object->contexts as $context) {
$output .= '<div class="ctools-context-holder clear-block">';
$output .= '<div class="ctools-context-title">' . t('Context @count', array(
'@count' => $count,
)) . '</div>';
$desc = check_plain($context['identifier']);
if (isset($context['keyword'])) {
$desc .= '<div class="description">' . t('Keyword: %@keyword', array(
'@keyword' => $context['keyword'],
)) . '</div>';
}
$output .= '<div class="ctools-context-content">' . $desc . '</div>';
$output .= '</div>';
$titles[ctools_context_id($context)] = $context['identifier'];
$count++;
}
}
// And relationships
if (!empty($object->relationships)) {
foreach ($object->relationships as $relationship) {
$output .= '<div class="ctools-context-holder clear-block">';
if (is_array($relationship['context'])) {
$rtitles = array();
foreach ($relationship['context'] as $cid) {
$rtitles[$cid] = $titles[$cid];
}
$title = implode(' + ', $rtitles);
}
else {
$title = $titles[$relationship['context']];
}
$output .= '<div class="ctools-context-title">' . t('From "@title"', array(
'@title' => $title,
)) . '</div>';
$desc = check_plain($relationship['identifier']);
if (isset($relationship['keyword'])) {
$desc .= '<div class="description">' . t('Keyword: %@keyword', array(
'@keyword' => $relationship['keyword'],
)) . '</div>';
}
$output .= '<div class="ctools-context-content">' . $desc . '</div>';
$output .= '</div>';
$titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier'];
$count++;
}
}
return $output;
}