我有一个自定义的 drupal 模块,我正在使用主题“表格”创建一个表格。
$header = array();
$header[] = array("data" => "Home Team");
$header[] = array("data" => "Away Team");
$row = array();
foreach ($node as $game) {
$row = [$hometeam), $awayteam)];
$rows[] = $row;
}
$table = theme('table', array('header' => $header, 'rows' => $rows));
return $table;
我也在我的站点中使用 Bootstrap 主题。 我想突出显示某些变量满足要求的所有行。例如,突出显示 'Home Team' == 'something' 的所有行。
在我看来,我无法覆盖主题类,还是我遗漏了什么?
最佳答案
如果像在此处创建标题一样构建行,则可以为行或单元格设置属性。 theme_table 中有一个示例将类添加到行的文档。
$rows = array(
// Simple row
array(
'Cell 1', 'Cell 2', 'Cell 3'
),
// Row with attributes on the row and some of its cells.
array(
'data' => array(
'Cell 1',
array('data' => 'Cell 2', 'colspan' => 2)
),
'class' => array('funky') // <-- row class
)
);
关于css - 根据变量突出显示表格行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29062662/