Mercurial > defr > drupal > popups_reference
changeset 9:8ced981c0dc0
Merge de la 1.0
author | Franck Deroche <franck@defr.org> |
---|---|
date | Mon, 23 Mar 2009 12:44:22 +0100 |
parents | ab667e3dc8ba (current diff) 571a89603e2b (diff) |
children | 108ced764a40 |
files | |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/popups_reference.module Mon Mar 23 12:44:10 2009 +0100 +++ b/popups_reference.module Mon Mar 23 12:44:22 2009 +0100 @@ -93,12 +93,19 @@ 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>'; + $form[$key]['#popups_reference_prefix'] = '<div id="'. $wrapper_id .'">'; + $form[$key]['#popups_reference_suffix'] = '<div>Add New: ' . implode(', ', $links) .'</div></div>'; + $form[$key]['#after_build'][] = 'popups_reference_after_build'; } } } +function popups_reference_after_build($form_element) { + $form_element['#prefix'] = $form_element['#popups_reference_prefix'] . $form_element['#prefix']; + $form_element['#suffix'] .= $form_element['#popups_reference_suffix']; + return $form_element; +} + /** * Generates 'Add new...' link * for each allowed content type @@ -114,7 +121,7 @@ // Target the wrapper for replacing. popups_add_popups(array('a.'.$wrapper_id=>array('targetSelectors'=>array('#'.$wrapper_id)))); } - else if ($widget_type == 'nodereference_autocomplete') { + else if ($widget_type == 'nodereference_autocomplete' || $widget_type == 'noderef_view_autocomplete') { // Don't replace the autocomplete when done. popups_add_popups(array('a.'.$wrapper_id=>array('noUpdate'=>TRUE))); }