Removing colons in field titles that have question marks

From ceejayoz

Jump to: navigation, search

Drupal adds a colon to the end of field titles, no matter what. This results in titles like What is your favourite colour?:

Placing the following code in a theme's template.php file removes the colon when a question mark is detected.

function phptemplate_form_element($element, $value) {
  $output = theme_form_element($element, $value);
  return preg_replace('@([.!?]):\s*(<span.*</span>){0,1}(</label>)@i', '$1$2$3', $output);
}
Personal tools