在drupal注释字段后删除冒号

时间:2011-02-14 01:58:47

标签: drupal layout

如何在drupal评论字段后删除冒号和红星信号。 (姓名:,电子邮件:,主页:)。我想删除之后的冒号(姓名,电子邮件,主页提交)。谢谢。

1 个答案:

答案 0 :(得分:0)

消除结肠和红色的“必填字段”星号(尽管可能会引入一些可用性问题),您可能会将以下内容添加到主题template.php文件中并覆盖Drupals核心theme_form_element():

function MYTHEMENAME_form_element($element, $value) {
  // This is also used in the installer, pre-database setup.
  $t = get_t();

  $output = '<div class="form-item"';
  if (!empty($element['#id'])) {
    $output .= ' id="' . $element['#id'] . '-wrapper"';
  }
  $output .= ">\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '"></span>' : '';

  if (!empty($element['#title'])) {
    $title = $element['#title'];
    if (!empty($element['#id'])) {
      $output .= ' <label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
    }
    else {
      $output .= ' <label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
    }
  }

  $output .= " $value\n";

  if (!empty($element['#description'])) {
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
  }

  $output .= "</div>\n";

  return $output;
}