function template_preprocess_spaces_dashboard_admin_region_form in Spaces 7.3
Same name and namespace in other branches
- 7 spaces_dashboard/theme/theme.inc \template_preprocess_spaces_dashboard_admin_region_form()
Theme function to display the dashboard block selector as a table.
File
- spaces_dashboard/
theme/ theme.inc, line 57
Code
function template_preprocess_spaces_dashboard_admin_region_form(&$variables) {
drupal_add_js(drupal_get_path('module', 'spaces_dashboard') . '/spaces_dashboard.admin.js');
drupal_add_css(drupal_get_path('module', 'spaces_dashboard') . '/spaces_dashboard.admin.css');
$form =& $variables['form'];
$variables['tables'] = '';
foreach (element_children($form['spaces_dashboard_layouts']) as $layout) {
$rows = array();
$title = check_plain($form['spaces_dashboard_layouts'][$layout]['#title']);
$description = check_plain($form['spaces_dashboard_layouts'][$layout]['#description']);
$help = t('Enable this layout for use with the dashboard. Select the regions that can be edited below.');
$label = "<strong>{$title}</strong> — <em>{$description}</em><div class='description'>{$help}</div>";
unset($form['spaces_dashboard_layouts'][$layout]['#title']);
unset($form['spaces_dashboard_layouts'][$layout]['#description']);
$header = array(
array(
'data' => $form['spaces_dashboard_layouts'][$layout],
'header' => TRUE,
),
array(
'data' => $label,
'header' => TRUE,
'colspan' => 2,
'class' => 'label',
),
);
foreach (element_children($form['spaces_dashboard_regions'][$layout]) as $region) {
$title = $form['spaces_dashboard_regions'][$layout][$region]['#title'];
unset($form['spaces_dashboard_regions'][$layout][$region]['#title']);
$rows[] = array(
array(
'data' => '',
),
array(
'data' => $form['spaces_dashboard_regions'][$layout][$region],
),
array(
'data' => check_plain($title),
'class' => 'label',
),
);
}
$variables['tables'] = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'class' => array(
'spaces-dashboard-regions',
),
),
));
}
unset($form['spaces_dashboard_layouts']);
unset($form['spaces_dashboard_regions']);
}