【问题标题】:Theme ALL Drupal 7 webforms of a certain content type主题 特定内容类型的所有 Drupal 7 网络表单
【发布时间】:2014-02-23 06:56:12
【问题描述】:

我知道如何使用 webform-form-[nid].tpl.php 覆盖 Drupal 7 网络表单,但如何为特定内容类型的所有 Drupal 7 网络表单设置主题。

该内容类型始终具有相同的形式,但 nid 会随着新节点 ID 的变化而变化,因此我无法使用正常方法。

这个可以吗?

【问题讨论】:

    标签: drupal drupal-7 drupal-theming drupal-webform


    【解决方案1】:

    您可以将节点类型添加到正文类.. 大约像这样:

    // 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;
      }
    }
    

    然后您可以按节点类型设置表单样式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多