| Versionen | |
|---|---|
| drupal7 | hook_node_view($node, $teaser) |
The node content is being assembled before rendering.
TODO D7 This needs work to clearly explain the different build modes.
The module may add elements to $node->content prior to rendering. This hook will be called after hook_view(). The structure of $node->content is a renderable array as expected by drupal_render().
When $node->build_mode is NODE_BUILD_RSS modules can also add extra RSS elements and namespaces to $node->rss_elements and $node->rss_namespaces respectively for the RSS item generated for this node. For details on how this is used
$node The node the action is being performed on.
$teaser The $teaser parameter from node_build().
modules/
<?php
function hook_node_view($node, $teaser) {
$node->content['my_additional_field'] = array(
'#value' => $additional_field,
'#weight' => 10,
'#theme' => 'mymodule_my_additional_field',
);
}
?>
Kommentare
Kommentar hinzufügen