我有一个自定义drupal模块,我正在使用主题'table'创建一个表。
$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'的所有行。
在我看来,我无法覆盖主题类,或者我错过了什么?
答案 0 :(得分:0)
如果您像在那里那样构建行,则可以设置行或单元格的属性。在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
)
);