You are here

function theme_purl_settings_form in Persistent URL 7

Same name and namespace in other branches
  1. 6 purl.admin.inc \theme_purl_settings_form()

Theme function for purl_settings_form()

File

./purl.admin.inc, line 127
Admin pages for the purl module.

Code

function theme_purl_settings_form($variables) {
  $form = $variables['form'];
  $output = '';
  $rows = array();
  foreach (element_children($form) as $id) {
    $row = array();
    if (isset($form[$id]['#provider'])) {
      $name = $form[$id]['#title'];
      $description = $form[$id]['#description'];
      unset($form[$id]['#title']);
      unset($form[$id]['#description']);
      $row[] = "<strong>{$name}</strong><div class='description'>{$description}</div>";
      $cell = $extra = '';
      foreach (element_children($form[$id]) as $item) {
        unset($form[$id][$item]['#title']);
        if ($item == 'extra') {
          $extra = drupal_render($form[$id][$item]);
        }
        $cell .= drupal_render($form[$id][$item]);
      }
      $row[] = $cell;
      $row[] = $extra;
    }
    $rows[] = $row;
  }
  $output .= theme('table', array(
    'header' => array(
      t('Provider'),
      t('Modifier type'),
      t('Settings'),
    ),
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  drupal_add_js(drupal_get_path("module", "purl") . "/purl.admin.js");
  return $output;
}