CSS:如何主题只提交按钮(而不是取消或后退按钮)-I´;我正在使用Drupal6

CSS:如何主题只提交按钮(而不是取消或后退按钮)-I´;我正在使用Drupal6,css,drupal,button,Css,Drupal,Button,我想用css主题一个特定的按钮:保存或提交一个。 我正在使用Drupal 6,我应该将它添加到我的template.tpl.php文件中,但这会覆盖所有按钮。。。我如何才能只提交目标按钮?我是否应该为$element['#提交']更改$element['#按钮类型'] <?php function theme_button($element) { // Make sure not to overwrite classes. if (isset($element['#attribut

我想用css主题一个特定的按钮:保存或提交一个。 我正在使用Drupal 6,我应该将它添加到我的template.tpl.php文件中,但这会覆盖所有按钮。。。我如何才能只提交目标按钮?我是否应该为
$element['#提交']
更改
$element['#按钮类型']

<?php
function theme_button($element) {
  // Make sure not to overwrite classes.
  if (isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class'];
  }
  else {
    $element['#attributes']['class'] = 'form-' . $element['#button_type'];
  }

  return '<input type="submit" ' . (empty($element['#name']) ? '' : 'name="' . $element['#name'] . '" ') . 'id="' . $element['#id'] . '" value="' . check_plain($element['#value']) . '" ' . drupal_attributes($element['#attributes']) . " />\n";
}
?>

谢谢你的帮助


Rosamunda

听起来最简单的方法是创建自己的按钮主题功能(就像您现在所做的那样),检查正在绘制的按钮类型,如果不是submit按钮,只需从自己的函数内部调用原始主题函数。

听起来最简单的方法是创建自己的按钮主题函数(正如您现在所做的),检查正在绘制的按钮类型,如果不是submit按钮,只需从您自己的函数内部调用原始主题函数