You are here

function theme_spaces_dashboard_admin_region_form in Spaces 6.3

Theme function to display the dashboar block selector as a table.

File

spaces_dashboard/spaces_dashboard.admin.inc, line 170

Code

function theme_spaces_dashboard_admin_region_form($form) {
  $rows = array();
  foreach (element_children($form['spaces_dashboard_layouts']) as $layout) {
    $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> &mdash; <em>{$description}</em><div class='description'>{$help}</div>";
    unset($form['spaces_dashboard_layouts'][$layout]['#title']);
    unset($form['spaces_dashboard_layouts'][$layout]['#description']);
    $rows[] = array(
      array(
        'data' => drupal_render($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' => drupal_render($form['spaces_dashboard_regions'][$layout][$region]),
        ),
        array(
          'data' => check_plain($title),
          'class' => 'label',
        ),
      );
    }
  }
  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');
  $output = theme('table', array(), $rows, array(
    'class' => 'spaces-dashboard-regions',
  ));
  $output .= drupal_render($form);
  return $output;
}