Problem with underscores in node types

Michel Poulain - October 28, 2009 - 00:29
Project:Workspace
Version:6.x-1.4-rc1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:duplicate
Description

When creating a node type, Drupal says: « Underscores will be converted into hyphens when constructing the URL of the create content page. »

But in the Workspace module, the "Add new item" form, just passes the $node_type without converting "underscores" into "hyphens". Resulting a blank page.

This patch corrects this issue. 1 line changed !

     if (isset($options[$node_type])) {
-      drupal_goto('node/add/' . $node_type);
+      drupal_goto('node/add/' . str_replace('_', '-', $node_type));
     }

AttachmentSize
workspace.patch448 bytes

#1

Michel Poulain - October 28, 2009 - 00:47

To be more precise...

The actual node add url with Workspace :
example.com/node/add/node_type [WRONG]

With this patch :
example.com/node/add/node-type [GOOD]

#2

Frank Ralf - October 28, 2009 - 07:08
Status:patch (to be ported)» duplicate

Duplicate of #344585: "Add new item" feature produces bad URLs for CCK content types. Please follow that thread, thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.