You are here

function node_overview_types in Drupal 5

Same name and namespace in other branches
  1. 6 modules/node/content_types.inc \node_overview_types()
  2. 7 modules/node/content_types.inc \node_overview_types()

Displays the content type admin overview page.

1 string reference to 'node_overview_types'
node_menu in modules/node/node.module
Implementation of hook_menu().

File

modules/node/content_types.inc, line 11
Content type editing UI.

Code

function node_overview_types() {
  $types = node_get_types();
  $names = node_get_types('names');
  $header = array(
    t('Name'),
    t('Type'),
    t('Description'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $rows = array();
  foreach ($names as $key => $name) {
    $type = $types[$key];
    if (function_exists($type->module . '_form')) {
      $type_url_str = str_replace('_', '-', $type->type);

      // Populate the operations field.
      $operations = array();

      // Set the edit column.
      $operations[] = array(
        'data' => l(t('edit'), 'admin/content/types/' . $type_url_str),
      );

      // Set the delete column.
      if ($type->custom) {
        $operations[] = array(
          'data' => l(t('delete'), 'admin/content/types/' . $type_url_str . '/delete'),
        );
      }
      else {
        $operations[] = array(
          'data' => '',
        );
      }
      $row = array(
        array(
          'data' => l($name, 'admin/content/types/' . $type_url_str),
          'class' => $class,
        ),
        array(
          'data' => check_plain($type->type),
          'class' => $class,
        ),
        array(
          'data' => check_plain($type->description),
          'class' => $class,
        ),
      );
      foreach ($operations as $operation) {
        $operation['class'] = $class;
        $row[] = $operation;
      }
      $rows[] = $row;
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No content types available.'),
        'colspan' => '5',
        'class' => 'message',
      ),
    );
  }
  return theme('table', $header, $rows);
}