hook_node_build_alter

  1. drupal
    1. drupal7
Versionen
drupal7 hook_node_build_alter($node, $teaser)

The node content was built, the module may modify the structured content.

This hook is called after the content has been assembled in $node->content and may be used for doing processing which requires that the complete node content structure has been built.

If the module wishes to act on the rendered HTML of the node rather than the structured content array, it may use this hook to add a #post_render callback. Alternatively, it could also implement hook_preprocess_node(). See drupal_render() and theme() documentation respectively for details.

Übergabeparameter

$node The node the action is being performed on.

$teaser The $teaser parameter from node_build().

Verwandte Themen

Code

modules/node/node.api.php, line 516

<?php
function hook_node_build_alter($node, $teaser) {
  // Check for the existence of a field added by another module.
  if (isset($node->content['an_additional_field'])) {
    // Change its weight.
    $node->content['an_additional_field']['#weight'] = -10;
  }

  // Add a #post_render callback to act on the rendered HTML of the node.
  $node->content['#post_render'][] = 'my_module_node_post_render';
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen