function total_control_node_types_content_type_render in Total Control Admin Dashboard 7.2
Same name and namespace in other branches
- 6.2 plugins/content_types/node_types.inc \total_control_node_types_content_type_render()
Run-time rendering of the body of the pane.
File
- plugins/
content_types/ node_types.inc, line 43
Code
function total_control_node_types_content_type_render($subtype, $conf, $panel_args, &$context) {
$types = node_type_get_types();
$access = user_access('administer content types');
$options = array(
'query' => array(
'destination' => 'admin/dashboard',
),
);
$header = array(
array(
'data' => t('Content type'),
),
array(
'data' => t('Operations'),
'colspan' => 3,
),
);
$rows = array();
foreach ($types as $type => $object) {
// Config data says to include the type.
if (!array_key_exists($type, $conf['types']) || (isset($conf['types']) && $conf['types'][$type]) == $type) {
// Check access, then add a link to create content.
if ($access) {
$type_url_str = str_replace('_', '-', $object->type);
$rows[] = array(
'data' => array(
t($object->name),
l(t('Configure'), 'admin/structure/types/manage/' . $type_url_str, $options),
l(t('Manage fields'), 'admin/structure/types/manage/' . $type_url_str . '/fields', $options),
l(t('Manage display'), 'admin/structure/types/manage/' . $type_url_str . '/display', $options),
),
);
}
}
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('There are no content types to display.'),
'colspan' => 4,
),
);
}
$link = '';
if (user_access('administer content types')) {
$link = l(t('Content type administration'), 'admin/structure/types');
}
$block = new stdClass();
$block->module = t('total_control');
$block->title = t('Manage Content types');
$block->content = theme('total_control_admin_table', array(
'header' => $header,
'rows' => $rows,
'link' => $link,
));
return $block;
}