From cf2ffc64689c5637e7dbc792788226a34b8b8c7e Mon Sep 17 00:00:00 2001
From: Christopher Gervais <chris@ergonlogic.com>
Date: Thu, 9 Feb 2012 08:53:21 -0500
Subject: [PATCH] Made 'reference overloading' error message more helpful

---
 corresponding_node_references.crud.inc |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/corresponding_node_references.crud.inc b/corresponding_node_references.crud.inc
index a7a7ceb..6d5b75a 100644
--- a/corresponding_node_references.crud.inc
+++ b/corresponding_node_references.crud.inc
@@ -164,15 +164,18 @@ function corresponding_node_references_update($home_node, $home_field, $away_nod
             else {
             	$t_reference = format_plural($references, '1 reference', '@count references');
             	$t_allowed = format_plural($allowed_references, '1 reference is', '@count references are');
-            	drupal_set_message(
-            	  t('Reference overloading: @title would of had @t_reference and only @t_allowed permitted. Before adding a reference,
-            	     you would need to <a href="@url">edit</a> @title to remove an existing reference and resave this node to have make it correspond.
-            	     Or you could allow this reference instance to have more references, go to the cck field settings of the instance',
+              drupal_set_message(
+                t('Reference overloading: <em>@title</em> would have had @t_reference and only @t_allowed permitted in <strong>@away_field</strong> on <strong>@away_node_type</strong>. Before adding a reference,
+                   you would need to <a href="@node_url">edit <em>@title</em></a> to remove an existing reference and resave this node to make it correspond.
+                   Alternatively, you could allow this field instance to have more references, by changing the <a href="@away_cck_url">cck field settings of the instance.</a>',
                   array(
-                    '@title' => $referenced_node->title,
-                    '@url' => url('node/'. $referenced_node->nid),
+                    '@title' => $referenced_node->title . ' (nid: ' . $referenced_node->nid . ')',
+                    '@node_url' => url('node/'. $referenced_node->nid . '/edit'),
                     '@t_reference' => $t_reference,
                     '@t_allowed' => $t_allowed,
+                    '@away_field' => $away_field,
+                    '@away_node_type' => $away_node_type,
+                    '@away_cck_url' => '/admin/content/node-type/' . str_replace('_', '-', $away_node_type) . '/fields/' . $away_field,
                   )
                 ),
                 'error'
-- 
1.7.2.5

