You are here

function theme_spaces_preset_default_form in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \theme_spaces_preset_default_form()
  2. 6 spaces_admin.inc \theme_spaces_preset_default_form()

Theme function for spaces_preset_default_form().

1 theme call to theme_spaces_preset_default_form()
spaces_preset_default_form in ./spaces_admin.inc
Page callback for generating a list of spaces presets. (admin/build/spaces)

File

./spaces.theme.inc, line 87

Code

function theme_spaces_preset_default_form($form) {
  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');
  $output = '';
  foreach (element_children($form['types']) as $type) {

    // Build table rows
    $rows = array();
    if (!empty($form['types'][$type]['info'])) {
      foreach (element_children($form['types'][$type]['info']) as $preset) {
        $rows[] = array(
          'data' => array(
            drupal_render($form['types'][$type]['default'][$preset]),
            drupal_render($form['types'][$type]['name'][$preset]),
            $form['types'][$type]['info'][$preset]['#value']['description'],
            $form['types'][$type]['info'][$preset]['#value']['links'],
          ),
          'class' => !empty($form['types'][$type]['info'][$preset]['#value']['disabled']) ? 'disabled' : '',
        );
      }
    }
    $rows[] = array(
      array(
        'data' => "<div class='buttons'>" . l(t('Add preset'), 'admin/build/spaces/presets/add/' . $type, array(
          'attributes' => array(
            'class' => 'button',
          ),
        )) . "</div>",
        'colspan' => 4,
      ),
    );

    // Add type heading and preset table to output
    $output .= "<h3>{$form['types'][$type]['#title']}</h3>";
    $output .= theme('table', array(
      '',
      t('Preset'),
      t('Description'),
      '',
    ), $rows, array(
      'class' => 'spaces-admin',
    ));
  }
  $output .= drupal_render($form['buttons']);
  $output .= drupal_render($form);
  return $output;
}