You are here

function _nd_preprocess_node in Node displays 6.2

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

Helper function used in either nd_preprocess_node or other preprocess function.

1 call to _nd_preprocess_node()
nd_preprocess_node in ./nd.module
Implementation of moduleName_preprocess_hook(). The node data will be rendered in regions. This uses a helper function so themers/developers can call that helper function from within their preprocess_hooks if they are fiddling with some data. For…

File

./nd.module, line 297
Node displays.

Code

function _nd_preprocess_node(&$vars, $hook) {
  $node = $vars['node'];

  // Break all the rendering if needed.
  if (!$node->render_by_ds) {
    return;
  }

  // Add nd-content_type-build_mode(-nid) template suggestion.
  $vars['template_files'][] = 'nd';
  $vars['template_files'][] = 'nd-' . $node->type;
  $vars['template_files'][] = 'nd-' . $node->type . '-' . $node->build_mode;
  $vars['template_files'][] = 'nd-' . $node->type . '-' . $node->build_mode . '-' . $node->nid;

  // Dont completely break things for users of 1.x
  if (function_exists('ds_render')) {
    $vars['content'] = ds_render($node->nid, $node, 'nd', $vars);
  }
  else {
    drupal_set_message('You are using incompatible versions of Display Suite and Node Displays. Please downgrade Node Displays to 2.6, or upgrade Display Suite to the 2.x branch.', 'warning');
    $vars['content'] = ds_render_content($node, 'nd', $vars);
  }
}