changeset 3:98642e828c60

Don't take over #prefix / #suffix if previously defined. This broke the "Add more" fonctionnality of CCK. Being E_STRICT compliant makes the code quite verbose though :-/
author Franck Deroche <franck@defr.org>
date Wed, 21 Jan 2009 14:39:42 +0100
parents 92ed2a629336
children 9d5826d3028d
files popups_reference.module
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/popups_reference.module	Wed Jan 21 14:17:45 2009 +0100
+++ b/popups_reference.module	Wed Jan 21 14:39:42 2009 +0100
@@ -92,8 +92,20 @@
     if ($links) {
       // Put the nodereference widget and links in an wrapper.
       // Makes it easy to find for Ahah targeting, and popups_reference behavior selecting.
-      $form[$key]['#prefix'] = '<div id="'. $wrapper_id .'">';
-      $form[$key]['#suffix'] = '<div>Add New: ' . implode(', ', $links) .'</div></div>';
+      $prefix = '<div id="'. $wrapper_id .'">';
+      if (isset($form[$key]['#prefix'])) {
+        $form[$key]['#prefix'] .= $prefix;
+      }
+      else {
+        $form[$key]['#prefix'] = $prefix;
+      }
+      $suffix = '<div>Add New: ' . implode(', ', $links) .'</div></div>';
+      if (isset($form[$key]['#suffix'])) {
+        $form[$key]['#suffix'] = $suffix . $form[$key]['#suffix'];
+      }
+      else {
+        $form[$key]['#suffix'] = $suffix;
+      }
     }
   }
 }