【发布时间】:2014-02-23 06:56:12
【问题描述】:
我知道如何使用 webform-form-[nid].tpl.php 覆盖 Drupal 7 网络表单,但如何为特定内容类型的所有 Drupal 7 网络表单设置主题。
该内容类型始终具有相同的形式,但 nid 会随着新节点 ID 的变化而变化,因此我无法使用正常方法。
这个可以吗?
【问题讨论】:
标签: drupal drupal-7 drupal-theming drupal-webform
我知道如何使用 webform-form-[nid].tpl.php 覆盖 Drupal 7 网络表单,但如何为特定内容类型的所有 Drupal 7 网络表单设置主题。
该内容类型始终具有相同的形式,但 nid 会随着新节点 ID 的变化而变化,因此我无法使用正常方法。
这个可以吗?
【问题讨论】:
标签: drupal drupal-7 drupal-theming drupal-webform
您可以将节点类型添加到正文类.. 大约像这样:
// Replace hook with your theme name and put this in your template.php
function hook_preprocess_html(&$vars) {
// Add class to body if certain node type
if ($node = menu_get_object()) {
$vars['classes_array'][] = "node-type-" . $node->type;
}
}
然后您可以按节点类型设置表单样式。
【讨论】: