function publishcontent_test_nodes in Publish Content 7
Menu callback.
List all nodes on the site with publish, unpublish links.
1 string reference to 'publishcontent_test_nodes'
- publishcontent_test_menu in tests/
publishcontent_test.module - Implements hook_menu().
File
- tests/
publishcontent_test.module, line 30 - A dummy module for listing all nodes with their publish, unpublish callback links to test permissions with.
Code
function publishcontent_test_nodes() {
$output = '';
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'node')
->execute();
if (!empty($result['node'])) {
$output .= '<ul>';
foreach (node_load_multiple(array_keys($result['node'])) as $node) {
$op = '';
if (empty($node->status) && publishcontent_publish_access($node)) {
$op = 'publish';
}
elseif (!empty($node->status) && publishcontent_unpublish_access($node)) {
$op = 'unpublish';
}
else {
continue;
}
$output .= '<li>' . $node->title . ' ' . l("{$op}-{$node->nid}", "node/{$node->nid}/{$op}/" . drupal_get_token(), array(
'query' => drupal_get_destination(),
)) . '</li>';
}
$output .= '</ul>';
}
return $output;
}