You are here

function theme_custom_formatters_overview in Custom Formatters 6

File

./custom_formatters.admin.inc, line 72
Contains administration functions for the Custom Formatters module.

Code

function theme_custom_formatters_overview($form) {
  $output = '';
  if (isset($form['export'])) {
    return $output;
  }
  $empty = !(isset($form['label']) && is_array($form['label']));
  $select_header = !$empty ? theme('table_select_header_cell') : '';
  $header = array(
    $select_header,
    t('Label'),
    t('Mode'),
    t('Field types'),
    t('Operations'),
  );
  $rows = array();
  $output .= drupal_render($form['options']);
  if (!$empty) {
    foreach (element_children($form['label']) as $key) {
      $row = array();
      $row[] = drupal_render($form['formatters'][$key]);
      $row[] = drupal_render($form['label'][$key]);
      $row[] = drupal_render($form['mode'][$key]);
      $row[] = drupal_render($form['fields'][$key]);
      $row[] = drupal_render($form['operations'][$key]);
      $rows[] = $row;
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No formatters available.'),
        'colspan' => '4',
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}