function theme_styleswitcher_admin_styles_table in Style Switcher 6.2
Same name and namespace in other branches
- 8.2 styleswitcher.module \theme_styleswitcher_admin_styles_table()
- 7.2 styleswitcher.admin.inc \theme_styleswitcher_admin_styles_table()
- 3.0.x styleswitcher.module \theme_styleswitcher_admin_styles_table()
Returns HTML for the styles settings overview form element.
Parameters
array $form: An element representing the form.
1 theme call to theme_styleswitcher_admin_styles_table()
- styleswitcher_config_theme in ./
styleswitcher.admin.inc - Page callback: Constructs a form for a theme-specific styles settings.
File
- ./
styleswitcher.admin.inc, line 380 - Styleswitcher configuration functionality.
Code
function theme_styleswitcher_admin_styles_table(array $form = array()) {
$header = array(
t('Style'),
t('Enabled'),
t('Default'),
t('Weight'),
);
$rows = array();
if (!empty($form['weight'])) {
foreach (element_children($form['weight']) as $key) {
if ($key == $form['default']['#default_value']) {
$form['enabled'][$key]['#attributes']['disabled'] = 'disabled';
}
// Build the table row.
$row = array(
drupal_render($form['name'][$key]),
drupal_render($form['enabled'][$key]),
drupal_render($form['default'][$key]),
drupal_render($form['weight'][$key]),
);
$rows[] = array(
'data' => $row,
'class' => 'draggable',
);
}
}
if (!$rows) {
$rows[][] = array(
'data' => t('No styles to switch.'),
'colspan' => 4,
'class' => 'empty message',
);
}
$output = theme('table', $header, $rows, array(
'id' => 'styleswitcher-styles-table',
));
drupal_add_tabledrag('styleswitcher-styles-table', 'order', 'sibling', 'styleswitcher-style-weight');
return $output;
}