function theme_taxonomy_access_grant_table in Taxonomy Access Control 7
Theme our grant table.
@todo Use a separate theme function for taxonomy_access_grant_add_table() to get out of nesting hell? @todo I clearly have no idea what I'm doing here.
1 theme call to theme_taxonomy_access_grant_table()
- taxonomy_access_element_info in ./
taxonomy_access.module - Implements hook_element_info().
File
- ./
taxonomy_access.admin.inc, line 477 - Administrative interface for taxonomy access control.
Code
function theme_taxonomy_access_grant_table($element_data) {
$table = array();
$table['header'] = $element_data['elements']['#header'];
$table['attributes']['class'] = array(
'taxonomy-access-grant-table',
);
$rows = array();
foreach (element_children($element_data['elements']) as $element_key) {
$child = $element_data['elements'][$element_key];
foreach (element_children($child) as $child_key) {
$record = $child[$child_key];
$row = array();
foreach (element_children($record) as $record_key) {
$data = array(
'data' => $record[$record_key],
);
// If it's the default, add styling.
if ($record_key == 'name') {
$data['class'] = array(
'taxonomy-access-label',
);
if ($child_key == TAXONOMY_ACCESS_VOCABULARY_DEFAULT) {
$data['class'][] = 'taxonomy-access-default';
}
}
elseif (in_array($record_key, array(
'view',
'update',
'delete',
'create',
'list',
))) {
$grant_class = $record_key . '-' . $data['data']['#default_value'];
$data['class'] = array(
'taxonomy-access-grant',
$grant_class,
);
}
$row[] = $data;
}
$rows[] = $row;
}
}
$table['rows'] = $rows;
return theme('table', $table);
}