/[drupal]/drupal/modules/node/node.module
ViewVC logotype

Diff of /drupal/modules/node/node.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1164, Fri Nov 6 03:59:06 2009 UTC revision 1.1165, Sat Nov 7 13:35:20 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node.module,v 1.1163 2009/11/05 16:13:21 webchick Exp $  // $Id: node.module,v 1.1164 2009/11/06 03:59:06 webchick Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1148  function node_build($node, $build_mode = Line 1148  function node_build($node, $build_mode =
1148      '#build_mode' => $build_mode,      '#build_mode' => $build_mode,
1149    );    );
1150    // Add contextual links for this node.    // Add contextual links for this node.
1151    $build['#contextual_links']['node'] = menu_contextual_links('node', array($node->nid));    // @todo Make this configurable per build mode.
1152      $build['#contextual_links']['node'] = array('node', array($node->nid));
1153    
1154      // Allow modules to modify the structured node.
1155      drupal_alter('node_build', $build);
1156    
1157    return $build;    return $build;
1158  }  }
# Line 1177  function node_build($node, $build_mode = Line 1181  function node_build($node, $build_mode =
1181   *   A node object.   *   A node object.
1182   * @param $build_mode   * @param $build_mode
1183   *   Build mode, e.g. 'full', 'teaser'...   *   Build mode, e.g. 'full', 'teaser'...
  *  
1184   */   */
1185  function node_build_content(stdClass $node, $build_mode = 'full') {  function node_build_content(stdClass $node, $build_mode = 'full') {
1186    // Remove previously built content, if exists.    // Remove previously built content, if exists.
# Line 1190  function node_build_content(stdClass $no Line 1193  function node_build_content(stdClass $no
1193    }    }
1194    
1195    // Build fields content.    // Build fields content.
1196      // @todo field_attach_prepare_view() is only invoked by node_build_multiple(),
1197      //   all other entities invoke it _here_.
1198      //field_attach_prepare_view('node', array($node->nid => $node), $build_mode);
1199    $node->content += field_attach_view('node', $node, $build_mode);    $node->content += field_attach_view('node', $node, $build_mode);
1200    
1201    // Always display a read more link on teasers because we have no way    // Always display a read more link on teasers because we have no way
# Line 1210  function node_build_content(stdClass $no Line 1216  function node_build_content(stdClass $no
1216    
1217    // Allow modules to make their own additions to the node.    // Allow modules to make their own additions to the node.
1218    module_invoke_all('node_view', $node, $build_mode);    module_invoke_all('node_view', $node, $build_mode);
   
   // Allow modules to modify the structured node.  
   drupal_alter('node_build', $node, $build_mode);  
1219  }  }
1220    
1221  /**  /**
# Line 1543  function node_search_execute($keys = NUL Line 1546  function node_search_execute($keys = NUL
1546    foreach ($find as $item) {    foreach ($find as $item) {
1547      // Render the node.      // Render the node.
1548      $node = node_load($item->sid);      $node = node_load($item->sid);
1549      node_build_content($node, 'search_result');      $build = node_build($node, 'search_result');
1550      $node->rendered = drupal_render($node->content);      unset($build['#theme']);
1551        $node->rendered = drupal_render($build);
1552    
1553      // Fetch comments for snippet.      // Fetch comments for snippet.
1554      $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);      $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);
# Line 2032  function node_feed($nids = FALSE, $chann Line 2036  function node_feed($nids = FALSE, $chann
2036    
2037      // The node gets built and modules add to or modify $node->rss_elements      // The node gets built and modules add to or modify $node->rss_elements
2038      // and $node->rss_namespaces.      // and $node->rss_namespaces.
2039      node_build_content($node, 'rss');      $build = node_build($node, 'rss');
2040        unset($build['#theme']);
2041    
2042      if (!empty($node->rss_namespaces)) {      if (!empty($node->rss_namespaces)) {
2043        $namespaces = array_merge($namespaces, $node->rss_namespaces);        $namespaces = array_merge($namespaces, $node->rss_namespaces);
2044      }      }
2045    
2046      if ($item_length != 'title' && !empty($node->content)) {      if ($item_length != 'title') {
2047        // We render node contents and force links to be last.        // We render node contents and force links to be last.
2048        $links = drupal_render($node->content['links']);        $build['links']['#weight'] = 1000;
2049        $item_text .= drupal_render($node->content) . $links;        $item_text .= drupal_render($build);
2050      }      }
2051    
2052      $items .= format_rss_item($node->title[FIELD_LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements);      $items .= format_rss_item($node->title[FIELD_LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements);
# Line 2185  function _node_index_node(stdClass $node Line 2190  function _node_index_node(stdClass $node
2190    variable_set('node_cron_last', $node->changed);    variable_set('node_cron_last', $node->changed);
2191    
2192    // Render the node.    // Render the node.
2193    node_build_content($node, 'search_index');    $build = node_build($node, 'search_index');
2194    $node->rendered = drupal_render($node->content);    unset($build['#theme']);
2195      $node->rendered = drupal_render($build);
2196    
2197    $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;    $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
2198    

Legend:
Removed from v.1.1164  
changed lines
  Added in v.1.1165

  ViewVC Help
Powered by ViewVC 1.1.2