Since all of the IDs/Classes in Drupal and Zen use dashes ( - ) rather than underscores ( _ ), I believe that the zen_id_safe function should replace underscores with dashes to be consistent.

This change also requires zen_id_safe to be wrapped around the line in which the node-type-* class is defined.


Patch Summary (all edits are made in zen/template.php):
1) changed line 183 from
$classes[] = 'node-type-' . $vars['type'];
$classes[] = zen_id_safe('node-type-' . $vars['type']);
2) Updated the preg_replace to replace underscores.
3) Fixed a line in the comments on line 249. It should read "// If the first character is not a-z, add 'id' in front.
", not "// If the first character is not a-z, add 'n' in front."

id_safe_update.patch1.08 KBkmonty


kmonty’s picture

Category: bug » task
JohnAlbin’s picture

Title: Updating zen_id_safe to remove underscores, fix a mistake in the code comments » Update zen_id_safe to remove underscores
Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Component: Miscellaneous » Code
Category: task » feature
Status: Needs review » Fixed

Sounds good to me. Also, Drupal core's body class "node-TYPE" already uses dashes instead of underscores.

Fixed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.