function nodeblock_ctools_block_info in Nodeblock 7
Implements hook_ctools_block_info().
The hook from Ctools.
File
- ./
nodeblock.module, line 733 - Enables use of specified node types as custom blocks.
Code
function nodeblock_ctools_block_info($module, $delta, &$info) {
// Load map of all Nodeblock NIDs and their node types.
$map =& drupal_static(__FUNCTION__);
if (!isset($map)) {
$query = db_select('nodeblock', 'nodeblock');
$query
->join('node', 'node', 'node.nid = nodeblock.nid');
$query
->fields('node', array(
'nid',
'type',
));
$query
->condition('nodeblock.enabled', 1);
$map = $query
->execute()
->fetchAllKeyed();
}
// Set category to the content type's name.
if (isset($map[$delta])) {
$type = node_type_get_type($map[$delta]);
$info['category'] = $type->name;
}
}