You are here

function theme_domain_overview_form in Domain Access 7.3

Theme the domain overview form.

File

./domain.admin.inc, line 1179
Administration functions for the domain module.

Code

function theme_domain_overview_form($variables) {
  $form = $variables['form'];
  if (!empty($form['error'])) {
    $output = drupal_render($form['error']);
    return $output;
  }

  // Add table javascript.
  drupal_add_js('misc/tableheader.js');
  drupal_add_tabledrag('domains', 'order', 'sibling', 'domain-weight');
  $header = $form['header']['#value'];
  $output = '';
  $output .= drupal_render($form['top']);
  $rows = array();
  foreach (element_children($form['domain']) as $key) {
    $row = array();
    foreach (element_children($form['domain'][$key]) as $item) {
      $row[] = array(
        'data' => drupal_render($form['domain'][$key][$item]),
        'class' => array(
          $item,
        ),
      );
    }
    $row[] = drupal_render($form['default_domain'][$key]);
    $row[] = drupal_render($form['domain_actions'][$key]);
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $attributes = array(
    'id' => 'domains',
    'sticky' => TRUE,
  );
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => $attributes,
  ));
  $output .= drupal_render_children($form);
  return $output;
}