You are here

function theme_content_type_overview_form in Content type overview 6

Same name and namespace in other branches
  1. 7 content_type_overview.module \theme_content_type_overview_form()

Render the main content type overview form. We do this by rendering each node type form as a table column. Each node type form is preprocessed to unfold fieldsets.

File

./content_type_overview.module, line 333
Provides easy access to all basic content type settings.

Code

function theme_content_type_overview_form($form) {
  $output = '';
  if (!empty($form['types'])) {

    // pre-process each node type form
    foreach (element_children($form['types']) as $type) {
      $elements[$type] = _content_type_overview_preprocess($form['types'][$type]);
    }
    $header = array(
      '',
    );
    $rows = array();

    // create table header
    $keys = array_keys($elements);
    $types = node_get_types('types', NULL, TRUE);
    foreach ($keys as $key) {
      $header[] = $types[$key]->name;
    }

    // create table rows
    foreach ($elements[$keys[0]] as $name => $value) {
      $row = array();
      foreach ($keys as $key) {

        // ignore hidden fields
        if ($elements[$key][$name]['class'] == 'hidden') {
          continue;
        }
        if ($elements[$key][$name]['class'] == 'group') {

          // set group heading
          $row[0] = array(
            'data' => $elements[$key][$name]['data'],
            'colspan' => count($keys) + 1,
          );
        }
        else {
          $row[0] = $elements[$key][$name]['title'];
          $row[] = $elements[$key][$name];
        }
      }
      $rows[] = $row;
    }
    $output .= theme('table', $header, $rows);
  }
  $output .= drupal_render($form);
  return $output;
}