diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 14663cb7668435d67ddbffa121ab5650fcfe6b3d..8bc6c747bcbda2bc449b1169e30d61dd5dc1af19 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,5 +2,7 @@ Bug Fixes * Getting collapsable fieldsets working for in autofill popups. * http://drupal.org/node/345353: Getting autofill working w/out page refresh. + * http://drupal.org/node/345353 (alaken) - fix issue with underscores in content names. + * backport of http://drupal.org/node/359524 by Cloudy - use human type names in link text. Notes * Needs Popups API 1.0-beta2 or better. \ No newline at end of file diff --git a/popups_reference.module b/popups_reference.module index 6df01eb9f42f204036a30a5e16683246b0120fc5..19274e80543ce500f5ab86efac5f5d5c2136224a 100644 --- a/popups_reference.module +++ b/popups_reference.module @@ -13,16 +13,11 @@ function popups_reference_form_alter($form_id, &$form) { if (isset($form['type'])) { $node = $form['#node']; if ($form['type']['#value'] .'_node_form' == $form_id) { -//dsm($form_id, 'form_id'); $fields = content_fields(); -// dsm($form); foreach ($form as $key => $item) { -//firep($key); if (is_array($item)) { $type = $item['#type']; -// dsm("$key, $type"); if ($type == 'fieldset') { // loop through all the subitems. -// firep($item, $key); foreach ($form[$key] as $subkey => $subitem) { popups_reference_alter_item($form[$key], $subkey, $subitem, $fields); } @@ -40,12 +35,9 @@ function popups_reference_form_alter($form_id, &$form) { function popups_reference_alter_item(&$form, $key, $item, $fields) { $field_name = strstr($key, 'field_'); -//dsm($key .', '. $field_name .', '. $fields[$field_name] .', '. $fields[$$field_name]['type']); -//dsm($key .', '. $field_name .', '. $fields[$field_name] .', '. $fields[$field_name]['type']); if (isset($fields[$field_name]) && $fields[$field_name]['type'] == 'nodereference') { $type = $form['type']['#value']; $field = content_fields($field_name, $form['type']['#value']); -//dsm($key .', '. $field['widget']['type']); if ($field['widget']['type'] == 'nodereference_select') { $id = 'popups-reference-' . _popups_reference_counter(); @@ -79,8 +71,6 @@ function _popups_reference_links($field, $src_type, $id=null) { ); } else { // Creating link to autofill box. -// $pclass = 'popups'; -// popups_add_popups(); $pclass = 'popups-reference-autofill'; popups_add_popups( array('.'.$pclass=>array( @@ -93,8 +83,8 @@ function _popups_reference_links($field, $src_type, $id=null) { $all_types = node_get_types(); foreach ($field['referenceable_types'] as $type => $value) { if (!empty($value) && user_access("create $type content")) { - $path = "node/add/$type"; - $links[] = l("Add $type", $path, array('class' => $pclass), "destination=node/add/$src_type"); + $path = "node/add/". strtr($type, '_', '-'); + $links[] = l("Add ". $all_types[$type]->name, $path, array('class' => $pclass), "destination=node/add/" . strtr($src_type, '_', '-')); } } return $links;