Closed (fixed)
Project:
Post Block
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2009 at 10:52 UTC
Updated:
2 Dec 2009 at 09:30 UTC
Jump to comment: Most recent
If you create a new node type (e.g. with CCK), and the internal node type contains an underscore, then Drupal internally replaces every '_' with a '-' in the node creation links. If you don't do this, then the postblock link won't work.
Following trivial patch fixes this problem:
--- postblock.module-1.1.2.3 Thu Oct 02 00:40:00 2008
+++ postblock.module Thu Feb 12 11:51:29 2009
@@ -114,8 +114,12 @@
break;
}
- $item->url = url('node/add/' . $item->type, $options);
- $item->link = l(t('Create a !typename', array('!typename' => $item->name)), 'node/add/' . $item->type, $options);
+ /* Drupal core automatically replaces underscores with hyphens in node type
+ names for node creation links in the navigation block. We also need to do
+ so, or the "Create X" link won't work. */
+ $sanitized_item_url = str_replace("_", "-", $item->type);
+ $item->url = url('node/add/' . $sanitized_item_url, $options);
+ $item->link = l(t('Create a !typename', array('!typename' => $item->name)), 'node/add/' . $sanitized_item_url, $options);
$vars['items'][] = $item;
}
}
Comments
Comment #1
Anonymous (not verified) commentedThanks! Fixed in latest version.