function theme_tac_fields_admin_form in Taxonomy Access Control 6
Renders the admin form in an HTML table.
File
- tac_fields/
tac_fields.admin.inc, line 427 - Administrative interface for TAC Fields.
Code
function theme_tac_fields_admin_form($form) {
$roles = _taxonomy_access_user_roles();
$header = array(
array(
'data' => t('Category'),
'colspan' => 3,
),
array(
'data' => t('View'),
'colspan' => 4,
),
array(
'data' => t('Update'),
'colspan' => 4,
),
);
$sub_header = array(
' <strong>' . t('<acronym title="Allow">A</acronym>') . '</strong>',
' <strong>' . t('<acronym title="Ignore">I</acronym>') . '</strong>',
' <strong>' . t('<acronym title="Deny">D</acronym>') . '</strong>',
' ',
);
$sub_header = array_merge(array(
' ',
), $sub_header, $sub_header);
$node_grant_types = array(
'view',
'update',
);
$radios = array(
'1' => t('Allow'),
'0' => t('Ignore'),
'2' => t('Deny'),
);
drupal_set_title(t('%field: Grants for %role', array(
'%field' => $form['field']['#value'],
'%role' => $roles[$form['rid']['#value']],
)));
$rows = array();
foreach (array_keys($form['vocabs']) as $vid) {
if (is_numeric($vid) and isset($form['grants'][$vid])) {
$row = $sub_header;
$row[0] = array(
'data' => '<h3>' . check_plain($form['vocabs'][$vid]['#title']) . '</h3>',
'colspan' => 3,
);
$rows[] = $row;
foreach (array_keys($form['grants'][$vid]) as $tid) {
if (is_numeric($tid)) {
$select_key = $tid ? 'selected_terms' : 'selected_defaults';
$select_id = $tid ? $tid : $vid;
$row = array(
array(
'data' => drupal_render($form[$select_key][$select_id]),
'colspan' => 3,
),
);
foreach ($node_grant_types as $grant) {
foreach (array_keys($radios) as $key) {
// I need this hack to display radio buttons horizontally (instead of standard form 'radios')
$row[] = array(
'data' => drupal_render($form['grants'][$vid][$tid][$grant][$key]),
);
}
$row[] = ' ';
}
$rows[] = $row;
}
}
}
}
if (isset($form['new'])) {
$row = $sub_header;
$row[0] = array(
'data' => '<h3>' . t('New') . '</h3>',
'colspan' => 3,
);
$rows[] = $row;
$row = array(
array(
'data' => drupal_render($form['new']['item']) . drupal_render($form['new']['recursive']),
'colspan' => '2',
),
drupal_render($form['new']['add']),
);
foreach ($node_grant_types as $grant) {
foreach (array_keys($radios) as $key) {
// I need this hack to display radio buttons horizontally (instead of standard form 'radios')
$row[] = array(
'data' => drupal_render($form['new']['grants'][$grant][$key]),
);
}
$row[] = ' ';
}
$rows[] = $row;
$row = array();
}
$output = '';
$output .= theme('table', $header, $rows);
$output .= drupal_render($form);
return $output;
}