| 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 |
| 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 |
} |
} |
| 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. |
| 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 |
| 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 |
/** |
/** |
| 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); |
| 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); |
| 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 |
|
|