function theme_brb_admin_settings in Browser Bouncer (brb) 7
File
- ./
brb.admin.inc, line 98 - Administrative page callbacks for the BrB module.
Code
function theme_brb_admin_settings($variables) {
$form = $variables['form'];
$output = '';
// element_children() gets only numeric keys
foreach (element_children($form['rows']) as $id) {
$this_row = array();
$this_row[] = $form['rows'][$id]['data']['#value'][0];
$this_row[] = drupal_render($form['rows'][$id]['url-' . $id]);
$this_row[] = drupal_render($form['rows'][$id]['exclude-' . $id]);
//Add the weight field to the row
$form['rows'][$id]['weight-' . $id]['#attributes']['class'][] = 'weight';
$this_row[] = drupal_render($form['rows'][$id]['weight-' . $id]);
//Add the row to the array of rows
$table_rows[] = array(
'data' => $this_row,
'class' => array(
'draggable',
),
);
}
$output = theme('table', array(
'header' => array(
t("Supported Browsers"),
t("URL"),
t("Exclude"),
t("Order"),
),
//Make sure the header count matches the column count
'rows' => $table_rows,
'attributes' => array(
'id' => 'browsers-table',
),
));
$output .= drupal_render_children($form);
// Call add_tabledrag to add and setup the JS for us
// The key thing here is the first param - the table ID
// and the 4th param, the class of the form item which holds the weight
drupal_add_tabledrag('browsers-table', 'order', 'sibling', 'weight');
return $output;
}