You are here

function block_inject_node_view in Block Inject 7

Implements hook_node_view().

File

./block_inject.module, line 152
The Block Inject module functions.

Code

function block_inject_node_view($node, $view_mode, $langcode) {

  // Only apply if we are looking at the full view mode.
  if ($view_mode !== 'full') {
    return;
  }

  // Check if there is an injectable region for this node type.
  $injectable = block_inject_get_region_by_node_type($node->type);
  if (!$injectable) {
    return;
  }

  // Inject the region.
  $render = block_inject_do_injection($node, $injectable);
  if ($render) {
    $node->content['body'][0]['#markup'] = $render;
  }
}