From b3a171be383a29e5b35ef45e9648a66370b878e2 Mon Sep 17 00:00:00 2001
From: "Jared K. Smith" <jsmith@fedoraproject.org>
Date: Thu, 5 Jul 2012 20:43:26 -0400
Subject: [PATCH] Cross-link content type settings from node add/edit form

This patch adds a link from the node/add page to be able to
edit the content types, if you have permissions to manage
the content types
---
 core/modules/node/node.admin.css |    4 ++++
 core/modules/node/node.pages.inc |   10 +++++++++-
 core/themes/seven/template.php   |    1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/core/modules/node/node.admin.css b/core/modules/node/node.admin.css
index 5777b1f..d20e5d9 100644
--- a/core/modules/node/node.admin.css
+++ b/core/modules/node/node.admin.css
@@ -10,3 +10,7 @@
 .revision-current {
   background: #ffc;
 }
+.node-type-edit {
+  font-size: .8em;
+  margin-left: .5em;
+}
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index faa3dea..c153eb0 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -40,6 +40,12 @@ function node_add_page() {
     $type = array_shift($content);
     drupal_goto('node/add/' . $type->type);
   }
+  elseif (user_access('administer content types')) {
+    // Generate links to edit content type if the current user has proper permissions.
+    foreach ($content as $key => $item) {
+      $content[$key]->edit_href = 'admin/structure/types/manage/'.$item->type;
+    }
+  }
   return array('#theme' => 'node_add_list', '#content' => $content);
 }
 
@@ -60,7 +66,9 @@ function theme_node_add_list($variables) {
   if ($content) {
     $output = '<dl class="node-type-list">';
     foreach ($content as $type) {
-      $output .= '<dt>' . l($type->name, 'node/add/' . $type->type) . '</dt>';
+      $output .= '<dt>' . l($type->name, 'node/add/' . $type->type); 
+      $output .= isset($type->edit_href) ? ' <span class="node-type-edit">[ ' . l(t('Edit content type'), $type->edit_href) . ' ]</span>' : '';
+      $output .= '</dt>';
       $output .= '<dd>' . filter_xss_admin($type->description) . '</dd>';
     }
     $output .= '</dl>';
diff --git a/core/themes/seven/template.php b/core/themes/seven/template.php
index d47f57a..3dfb205 100644
--- a/core/themes/seven/template.php
+++ b/core/themes/seven/template.php
@@ -48,6 +48,7 @@ function seven_node_add_list($variables) {
     foreach ($content as $type) {
       $output .= '<li class="clearfix">';
       $output .= '<span class="label">' . l($type->name, 'node/add/' . $type->type) . '</span>';
+      $output .= isset($type->edit_href) ? ' <span class="node-type-edit">[ ' . l(t('Edit content type'), $type->edit_href) . ' ]</span>' : '';
       $output .= '<div class="description">' . filter_xss_admin($type->description) . '</div>';
       $output .= '</li>';
     }
-- 
1.7.10.4

