You are here

function theme_spaces_block_customizer_settings_form in Spaces 6

Same name and namespace in other branches
  1. 6.2 spaces.theme.inc \theme_spaces_block_customizer_settings_form()

Form theming for the block customizer settings form.

1 theme call to theme_spaces_block_customizer_settings_form()
space_customizer_block::form in ./spaces.module
Implementation of form().

File

./spaces.module, line 1721

Code

function theme_spaces_block_customizer_settings_form($form) {

  // Add draggable weights
  drupal_add_js('misc/tableheader.js');
  $output = '';

  // List of block regions that should force an empty display
  $force_empty = array(
    'content',
  );
  global $theme_key;
  init_theme();
  $regions = system_region_list($theme_key);
  foreach ($force_empty as $region) {
    if (empty($form[$region]) && !empty($regions[$region])) {
      $output .= "<div class='region-{$region}'>";
      $output .= "<h3>{$regions[$region]}</h3>";
      $output .= "<div class='spaces-empty'>" . t('There are no options available for this region.') . "</div>";
      $output .= "</div>";
    }
  }
  foreach (element_children($form) as $a) {
    drupal_add_tabledrag('spaces-customizer-blocks-' . $a, 'order', 'sibling', 'block-weight');
    $rows = array();
    uasort($form[$a], 'element_sort');
    foreach (element_children($form[$a]) as $b) {
      $form[$a][$b]['weight']['#attributes'] = array(
        'class' => 'block-weight',
      );
      $row = array(
        'dummy' => '',
        'status' => drupal_render($form[$a][$b]['status']),
        'title' => array(
          'data' => drupal_render($form[$a][$b]['subject']),
          'class' => 'fill',
        ),
        'weight' => drupal_render($form[$a][$b]['weight']),
      );
      $rows[] = array(
        'data' => $row,
        'class' => 'draggable',
      );
    }
    $output .= "<div class='region-{$a}'>";
    $output .= "<h3>{$form[$a]['#title']}</h3>";
    $output .= theme('table', array(), $rows, array(
      'id' => 'spaces-customizer-blocks-' . $a,
    ));
    $output .= "</div>";
  }
  $output .= drupal_render($form);
  return $output;
}