function theme_certificate_overview_form in Certificate 6
Same name and namespace in other branches
- 6.2 certificate.admin.inc \theme_certificate_overview_form()
Theme overview form.
Arranges certificates in a table.
See also
certificate_overview_form()
File
- ./certificate.admin.inc, line 536 
- Administrative pages for the module.
Code
function theme_certificate_overview_form($form) {
  $rows = array();
  foreach (element_children($form['certificates']) as $key) {
    $row = array();
    // Render the hidden 'certificate id' field and the title of the certificate into the
    // same column of the row.
    $row[] = drupal_render($form['certificates'][$key]['cid']) . drupal_render($form['certificates'][$key]['title']);
    // Render the edit and delete links into their own column.
    $row[] = drupal_render($form['certificates'][$key]['operations']);
    // Add the new row to our collection of rows.
    $rows[] = array(
      'data' => $row,
    );
  }
  // If there were no certificates found, let users know.
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No certificate templates have been added.'),
        'colspan' => 3,
      ),
    );
  }
  // Render a list of header titles, and our array of rows, into a table. Even
  // we've already rendered all of our certificates, we always call drupal_render()
  // on the form itself after we're done, so hidden security fields and other
  // elements (like buttons) will appear properly at the bottom of the form.
  $header = array(
    t('Title'),
    t('Operations'),
  );
  // Add an optional caption that appears above the table.
  $caption = t('');
  $output = theme('table', $header, $rows, array(
    'id' => 'certificates-overview',
  ), $caption);
  $output .= drupal_render($form);
  return $output;
}