function _theme_nodes in Module Grants 6
Theme the passed-in nodes as a table.
Parameters
$nodes: Array of nodes to display.
Return value
Themed table HTML or a paragraph saying 'No content found'.
2 calls to _theme_nodes()
- theme_module_grants_editable_nodes in ./
module_grants.module - Display in a table a summary of all content editable to the logged-in user.
- theme_module_grants_viewable_nodes in ./
module_grants.module - Display in a table a summary of all content viewable to the logged-in user.
File
- ./
module_grants.module, line 280 - Module to enable access control for unpublished content. Also makes sure that modules that operate on access grants behave in the expected way when enabled together.
Code
function _theme_nodes($nodes) {
if (count($nodes) > 0) {
$header = array(
t('Title'),
t('Type'),
t('Last updated'),
t('By'),
t('Published?'),
);
$show_taxonomy_terms = module_exists('taxonomy');
$show_workflow_state = module_exists('workflow');
if ($show_taxonomy_terms) {
$header[] = t('Term');
}
if ($show_workflow_state) {
$header[] = t('Workflow state');
}
$rows = array();
$page_link = user_access('view revisions') ? 'revisions' : 'view';
foreach ($nodes as $node) {
$row = array(
l($node->title, "node/{$node->nid}/{$page_link}"),
check_plain(node_get_types('name', $node)),
format_date($node->timestamp),
theme('username', user_load(array(
'uid' => $node->uid,
))),
$node->status ? t('Yes') : t('No'),
);
if ($show_taxonomy_terms) {
$row[] = empty($node->term) ? '' : check_plain($node->term);
}
if ($show_workflow_state) {
$row[] = empty($node->state) ? t('No state') : check_plain($node->state);
}
$rows[] = $row;
}
return theme('table', $header, $rows);
}
return '<p>' . t('No content found.') . '</p>';
}