| 1 |
<?php |
<?php |
| 2 |
// $Id: nodeblock.module,v 1.8 2009/01/30 19:36:41 rz Exp $ |
// $Id: nodeblock.module,v 1.10 2009/02/05 20:00:12 rz Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 118 |
// otherwise we just use the main node |
// otherwise we just use the main node |
| 119 |
} |
} |
| 120 |
|
|
| 121 |
|
// Set a flag so that themes have more context. |
| 122 |
|
$node->nodeblock = TRUE; |
| 123 |
|
|
| 124 |
$block['subject'] = $node->title; |
$block['subject'] = $node->title; |
| 125 |
// using page arg = TRUE since we want the full content (generally speaking) |
$block['content'] = node_view($node, FALSE, FALSE, TRUE); |
|
$block['content'] = node_view($node, FALSE, TRUE, TRUE); |
|
| 126 |
|
|
| 127 |
return $block; |
return $block; |
| 128 |
} |
} |
| 160 |
|
|
| 161 |
return $links; |
return $links; |
| 162 |
} |
} |
| 163 |
|
|
| 164 |
|
/** |
| 165 |
|
* Implementation of hook_preprocess_node(). |
| 166 |
|
* |
| 167 |
|
* Add node-nodeblock-default to the suggested theme files for all nodeblock |
| 168 |
|
* enabled nodes. Note that the template is "unshifted" onto the template files |
| 169 |
|
* array. This gives the template file a lower priority than any node-nodetype |
| 170 |
|
* templates, but a higher priority than a generic node.tpl.php. |
| 171 |
|
*/ |
| 172 |
|
function nodeblock_preprocess_node(&$variables) { |
| 173 |
|
if ($variables['node']->nodeblock) { |
| 174 |
|
array_unshift($variables['template_files'], 'node-nodeblock-default'); |
| 175 |
|
} |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
/** |
| 179 |
|
* Implementation of hook_theme_registry_alter(). |
| 180 |
|
* |
| 181 |
|
* Add nodeblock path to the 'theme paths' for the 'node' hook. This allows us |
| 182 |
|
* to use node-nodeblock-default.tpl.php from the module directory. Note that |
| 183 |
|
* the path is "unshifted" onto the theme paths array. This puts the module path |
| 184 |
|
* before the modules/node path, but since neither of these modules implements |
| 185 |
|
* the same templates, there is not problem. |
| 186 |
|
*/ |
| 187 |
|
function nodeblock_theme_registry_alter(&$registry) { |
| 188 |
|
array_unshift($registry['node']['theme paths'], drupal_get_path('module', 'nodeblock')); |
| 189 |
|
} |