为什么 drupal 视图 css 类名会改变

发布于 2024-12-03 20:51:09 字数 156 浏览 1 评论 0原文

目前,Drupal 视图遇到了一个令人恼火的怪癖,它将更改提供的 css 类名称。

例如,如果我添加类 container_12 ,它将呈现为 container-12

知道如何关闭它吗?

谢谢。

Currently experiencing an irritating quirk of Drupal views where it will change the provided css class name.

For example, if I add the class container_12 it will be rendered as container-12.

Any idea how to turn this off?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪若未夕 2024-12-10 20:51:09

Views 这样做是因为 Drupal 的 CSS 编码标准。您可以使用 phptemplate_preprocess_views_view(&$vars) 更改行为。这是一个例子。

function phptemplate_preprocess_views_view(&$vars) {
  $css_class = $view->display_handler->get_option('css_class');
  if (!empty($css_class)) {
    $vars['classes_array'][] = $vars['css_class'];
  }
}

另外,我只是建议您更改 css,如果您使用框架,您可以在 drupal.org 上轻松找到带有框架的基本主题。

Views doest it because of CSS codeing standards from Drupal. You can change the behavior with phptemplate_preprocess_views_view(&$vars). Here is an example.

function phptemplate_preprocess_views_view(&$vars) {
  $css_class = $view->display_handler->get_option('css_class');
  if (!empty($css_class)) {
    $vars['classes_array'][] = $vars['css_class'];
  }
}

Also, I just can advise you to change you css, if you use a framework you can easily find a base theme with you framework on drupal.org.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文