Skip to content

Instantly share code, notes, and snippets.

@apperceive
Created November 19, 2015 16:51
Show Gist options
  • Save apperceive/074cad7de7bb476ce4cd to your computer and use it in GitHub Desktop.
Save apperceive/074cad7de7bb476ce4cd to your computer and use it in GitHub Desktop.
Simple Drupal theme_table example
<?php
$colb = array(
'data' => 'b',
'header' => false, // cell is a header
'class' => 'bclass bclass',
'any-td-attr' => 'bvalue',
);
$cella2 = array(
'data' => 'a2',
//'header' => false, // cell is a header
'class' => 'aclass aaclass',
'any-td-attr' => 'avalue',
);
$cols = array('a', $colb, 'c');
$data = array(
array('a1', 'b1', 'c1'),
array($cella2, 'b2', 'c2'),
array('a3', 'b3', 'c3'),
array('a4', 'b4', 'c4'),
);
$vars = array(
'header' => $cols,
'rows' => $data,
'attributes' => array(),
'caption' => 'caption goes here',
'colgroups' => array(),
'sticky' => true,
'empty' => 'no data dada',
);
drupal_set_message(theme_table($vars));
print theme_table($vars);
@apperceive
Copy link
Author

goal style cell, test heading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment