You are here

function theme_classified_admin_lifetimes in Classified Ads 6.3

Same name and namespace in other branches
  1. 7.3 classified.admin.inc \theme_classified_admin_lifetimes()

Render the ad lifetimes as a table.

Parameters

array $form: An array form.

Return value

array A render array.

See also

classified_admin_settings()

1 theme call to theme_classified_admin_lifetimes()
classified_admin_settings in ./classified.admin.inc
Implements hook_settings().

File

./classified.admin.inc, line 176
Admin page(s) for the classified module.

Code

function theme_classified_admin_lifetimes($form = NULL) {
  $header = array(
    t('Category'),
    t('Days'),
  );
  $rows = array();
  foreach (element_children($form) as $key) {
    $element =& $form[$key];
    if ($key == 'classified-lifetime-default') {
      $title = $element['#title'] . '<div class="description">' . $element['#description'] . '</div>';
      $element['#title'] = $element['#description'] = NULL;
      $rows[] = array(
        $title,
        drupal_render($element),
      );
    }
    elseif ($key == 'classified-grace') {
      $title = $element['#title'] . '<div class="description">' . $element['#description'] . '</div>';
      $element['#title'] = $element['#description'] = NULL;
      $rows[] = array(
        $title,
        drupal_render($element),
      );
    }
    elseif (strpos($key, 'classified-lifetime-') !== 0) {
      continue;
    }
    else {
      $title = $element['#title'];
      $element['#title'] = NULL;
      $rows[] = array(
        $title,
        drupal_render($element),
      );
    }
  }
  $ret = theme('table', $header, $rows, array(
    'id' => 'classified-admin-settings-lifetimes',
  ));
  $ret .= drupal_render($form);
  return $ret;
}