1 node.module | node_block_view($delta = '', $settings = array()) |
Implements hook_block_view().
File
- core/
modules/ node/ node.module, line 2099 - The core module that allows content to be submitted to the site.
Code
function node_block_view($delta = '', $settings = array()) {
// This example is adapted from node.module.
$block = array();
switch ($delta) {
case 'syndicate':
if (backdrop_valid_path('rss.xml')) {
$block['subject'] = t('Syndicate');
$block['content'] = node_syndicate_content($settings);
}
break;
case 'recent':
if (user_access('access content')) {
$settings += array(
'node_count' => 10,
);
$block['subject'] = t('Recent content');
if ($nodes = node_get_recent($settings['node_count'])) {
$block['content'] = array(
'#theme' => 'node_recent_block',
'#nodes' => $nodes,
);
}
else {
$block['content'] = t('No content available.');
}
}
break;
}
return $block;
}