You are here

function theme_classified_admin_lifetimes in Classified Ads 7.3

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

Render the ad lifetimes as a table.

Parameters

array $variables: A theme arguments array. Single key: form.

Return value

array A render array.

Throws

\Exception

See also

classified_admin_settings()

1 theme call to theme_classified_admin_lifetimes()
classified_admin_settings in ./classified.admin.inc
Page controller for settings form.

File

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

Code

function theme_classified_admin_lifetimes(array $variables) {
  $form = $variables['form'];
  $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', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'classified-admin-settings-lifetimes',
    ),
  ));
  $ret .= drupal_render_children($form);
  return $ret;
}