summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.module15
-rw-r--r--modules/node/node.tpl.php5
2 files changed, 16 insertions, 4 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 4c85affad..de59e22f7 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1112,6 +1112,9 @@ function node_build($node, $build_mode = 'full') {
'#node' => $node,
'#build_mode' => $build_mode,
);
+ // Add contextual links for this node.
+ $build['#contextual_links']['node'] = menu_contextual_links('node', array($node->nid));
+
return $build;
}
@@ -1806,11 +1809,13 @@ function node_menu() {
'page arguments' => array(1),
'access callback' => 'node_access',
'access arguments' => array('view', 1),
- 'type' => MENU_CALLBACK);
+ 'type' => MENU_CALLBACK,
+ );
$items['node/%node/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -10);
+ 'weight' => -10,
+ );
$items['node/%node/edit'] = array(
'title' => 'Edit',
'page callback' => 'node_page_edit',
@@ -1818,8 +1823,9 @@ function node_menu() {
'access callback' => 'node_access',
'access arguments' => array('update', 1),
'theme callback' => '_node_custom_theme',
- 'weight' => 1,
+ 'weight' => 0,
'type' => MENU_LOCAL_TASK,
+ 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'file' => 'node.pages.inc',
);
$items['node/%node/delete'] = array(
@@ -1829,7 +1835,8 @@ function node_menu() {
'access callback' => 'node_access',
'access arguments' => array('delete', 1),
'weight' => 1,
- 'type' => MENU_CALLBACK,
+ 'type' => MENU_LOCAL_TASK,
+ 'context' => MENU_CONTEXT_INLINE,
'file' => 'node.pages.inc',
);
$items['node/%node/revisions'] = array(
diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php
index aa470f850..c05d7e8bf 100644
--- a/modules/node/node.tpl.php
+++ b/modules/node/node.tpl.php
@@ -18,6 +18,7 @@
* - $node_url: Direct url of the current node.
* - $terms: the themed list of taxonomy term links output from theme_links().
* - $display_submitted: whether submission information should be displayed.
+ * - $contextual_links (array): An array of contextual links for the node.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the following:
@@ -74,6 +75,10 @@
<?php print $user_picture; ?>
+ <?php if (!$page && $contextual_links): ?>
+ <?php print render($contextual_links); ?>
+ <?php endif; ?>
+
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $node_title; ?></a></h2>
<?php endif; ?>