You are here

function theme_spaces_preset_form in Spaces 6.3

Theme function for spaces_preset_form().

1 theme call to theme_spaces_preset_form()
spaces_preset_form in ./spaces.admin.inc
Generate a form snippet for choosing a spaces preset.

File

./spaces.theme.inc, line 24

Code

function theme_spaces_preset_form($form) {
  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
  $header = array(
    array(
      'data' => check_plain($form['#title']),
      'colspan' => isset($form['storage']) ? 4 : 3,
    ),
  );
  $type = $form['#space_type'];
  $rows = array();
  if (!empty($form['#description'])) {
    $rows[] = array(
      array(
        'data' => "<div class='description'>{$form['#description']}</div>",
        'colspan' => isset($form['storage']) ? 4 : 3,
      ),
    );
  }
  foreach (element_children($form['labels']) as $preset) {
    $row = array();
    $row[] = array(
      'class' => 'option',
      'data' => drupal_render($form["spaces_preset_{$type}"][$preset]),
    );
    $row[] = array(
      'class' => 'label',
      'data' => drupal_render($form['labels'][$preset]),
    );
    if (isset($form['storage'][$preset])) {
      $row[] = array(
        'class' => 'storage',
        'data' => drupal_render($form['storage'][$preset]),
      );
    }
    $row[] = array(
      'class' => 'actions',
      'data' => drupal_render($form['actions'][$preset]),
    );
    $rows[] = array(
      'class' => !empty($form["spaces_preset_{$type}"][$preset]) ? 'enabled' : 'disabled',
      'data' => $row,
    );
  }
  $output = theme('table', $header, $rows, array(
    'class' => 'spaces',
  ));
  $output .= drupal_render($form);
  return $output;
}