You are here

function theme_domain_prefix_configure_form in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_prefix/domain_prefix.admin.inc \theme_domain_prefix_configure_form()

FormsAPI theming for domain_prefix_configure_form.

File

domain_prefix/domain_prefix.module, line 287
Interface for selective table prefixing for use with Domain Access. For this module to work correctly, you will need to follow the INSTALL.txt instructions for editing your settings.php file.

Code

function theme_domain_prefix_configure_form($form) {
  $output = t('<p>These settings control advanced functions.  Please read the documentation carefully.</p>');
  $header = array(
    t('Table'),
    t('Source'),
    t('Ignore'),
    t('Create'),
    t('Copy'),
  );
  if ($form['prefix_theme']['#value'] > 0) {
    $header[] = t('Update');
    $header[] = t('Drop');
    unset($form['prefix_theme']);
  }
  $output = drupal_render($form['domain']);
  foreach (element_children($form['domain_prefix']) as $key) {
    if ($form['domain_prefix'][$key]['#description']) {
      $rows[] = array(
        '<b>' . $form['domain_prefix'][$key]['#description'] . '</b>',
        array(
          '',
          'colspan' => 4,
        ),
      );
    }
    $row = array();
    $row[] = ' - ' . $form['domain_prefix'][$key]['#title'];

    // Insert the source selection element.
    $row[] = drupal_render($form['domain_source']['_source_' . $key]);
    foreach (element_children($form['domain_prefix'][$key]) as $option) {
      $row[] = drupal_render($form['domain_prefix'][$key][$option]);
    }

    // Throw the rest away, since we already rendered what we want from it.
    $render = drupal_render($form['domain_prefix'][$key]);
    $rows[] = $row;
  }
  $output .= theme('table', $header, $rows);
  $output .= drupal_render($form);
  return $output;
}