You are here

function theme_domain_alias_form in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain_alias/domain_alias.admin.inc \theme_domain_alias_form()
  2. 7.3 domain_alias/domain_alias.admin.inc \theme_domain_alias_form()

Form theming.

File

domain_alias/domain_alias.admin.inc, line 279
Administration functions for the domain_alias module.

Code

function theme_domain_alias_form($variables) {
  $form = $variables['form'];
  $output = '';
  $redirect = t('Check the redirect box to send requests for an alias to the registered domain.');
  $output .= drupal_render($form['domain_help']);
  $output .= '<br /><h3>' . drupal_render($form['domain']) . '</h3>';

  // Edit existing records.
  $elements = element_children($form['domain_alias']);
  if (!empty($elements)) {
    $header = array(
      t('Id'),
      t('Redirect'),
      t('Pattern'),
      t('Delete'),
    );
    $rows = array();
    foreach ($elements as $element) {
      $rows[] = array(
        $form['domain_alias'][$element]['alias_id']['#value'],
        drupal_render($form['domain_alias'][$element]['redirect']),
        drupal_render($form['domain_alias'][$element]['pattern']),
        drupal_render($form['domain_alias'][$element]['delete']),
      );
    }
    $output .= theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
    $output .= '<p><em>' . $redirect . '</em></p>';
  }
  else {
    $output .= '<p>' . t('There are no aliases recorded for this domain.') . '</p>';
  }

  // Add new records.
  $output .= '<br /><h3>' . drupal_render($form['domain_new']) . '</h3>';
  $output .= '<p>' . drupal_render($form['domain_new_help']) . '</p>';
  $header = array(
    t('Redirect'),
    t('Pattern'),
  );
  $rows = array();
  foreach (element_children($form['domain_alias_new']) as $element) {
    $rows[] = array(
      drupal_render($form['domain_alias_new'][$element]['redirect']),
      drupal_render($form['domain_alias_new'][$element]['pattern']),
    );
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= '<p><em>' . $redirect . '</em></p>';
  $output .= drupal_render_children($form);
  return $output;
}