You are here

function _nd_nodeapi in Node displays 6.3

Same name and namespace in other branches
  1. 6 nd.module \_nd_nodeapi()
  2. 6.2 nd.module \_nd_nodeapi()
  3. 7 nd.module \_nd_nodeapi()

Helper function to alter node properties

Parameters

stdClass $node The complete node object.:

1 call to _nd_nodeapi()
nd_nodeapi in ./nd.module
Implementation of hook_nodeapi().

File

./nd.module, line 216
Node displays.

Code

function _nd_nodeapi(&$node) {

  // Build fields and regions.
  nd_build_fields_and_regions($node);

  // Special support for RSS.
  if ($node->build_mode == NODE_BUILD_RSS && $node->render_by_ds == TRUE) {
    foreach (element_children($node->content) as $key => $field) {
      if (!isset($node->ds_fields[$field])) {
        $node->content[$field]['#access'] = FALSE;
      }
      $node->content[$field]['#weight'] = $node->ds_fields[$field]['weight'];
      unset($node->ds_fields[$field]);
    }
    foreach ($node->ds_fields as $key => $field) {
      $render_key = $key . '_rendered';
      $node->content[$key]['#value'] = theme('ds_field', $node->{$render_key}, $node->ds_fields[$key]);
      $node->content['#content_extra_fields'][$key]['weight'] = $node->ds_fields[$key]['weight'];
    }

    // Body and title are tricky ones since their weights are set
    // in #content_extra_fields, so update the value there!
    $node->content['#content_extra_fields']['body_field']['weight'] = $node->content['body']['#weight'];
    $node->content['#content_extra_fields']['title']['weight'] = $node->content['title']['#weight'];
  }
  if (function_exists('rules_invoke_event')) {
    rules_invoke_event('nd_node_is_build', array(
      'node' => &$node,
    ));
  }
}