Drupal 7 Bootstrap page.vars类(按内容类型)
我正在尝试修改引导子主题中的page.vars,以根据内容类型更改类 作为page.vars中的标准代码Drupal 7 Bootstrap page.vars类(按内容类型),drupal,drupal-7,twitter-bootstrap-3,Drupal,Drupal 7,Twitter Bootstrap 3,我正在尝试修改引导子主题中的page.vars,以根据内容类型更改类 作为page.vars中的标准代码 elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) { $variables['content_column_class'] = ' class="col-sm-9"'; } 我的修改代码: elseif (!empty
elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
$variables['content_column_class'] = ' class="col-sm-9"';
}
我的修改代码:
elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
$node = $variables['node'];
if ($node->type == 'standard') {
$variables['content_column_class'] = ' class="col-sm-6"';
}
}
我试图实现的是将col-sm-6类放在每个标准内容类型页面上。看起来您正在共享的代码是正确的,但是您需要告诉您的子主题阅读page.vars.php文件。我刚刚处理了一个类似的问题,并根据信息提出了这个解决方案 您需要做的是在子主题的template.php中添加一个主题函数,类似于:
function SUB_THEME_theme(&$existing, $type, $theme, $path) {
bootstrap_include($theme, 'theme/system/page.vars.php');
$hooks = array();
return $hooks;
}
然后,您可以在子主题中添加theme/system/page.vars.php,page.vars.php文件中的任何函数都将包含在注册表中,并在引导基本主题之后应用。完成后,上述代码应该可以正常工作