node_overview_types

Versions
5 – 7
node_overview_types()

Displays the content type admin overview page.

Code

modules/node/content_types.inc, line 11

<?php
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);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.