1 node.types.inc node_overview_types()

Page callback: Displays the content type admin overview page.

See also

node_menu()

File

core/modules/node/node.types.inc, line 12
Content type editing user interface.

Code

function node_overview_types() {
  $types = node_type_get_types();
  $names = node_type_get_names();
  $field_ui = module_exists('field_ui') && user_access('administer fields');
  $header = array(t('Name'), t('Description'), t('Operations'));
  $rows = array();

  // Sort the list of content types by label instead of machine name.
  natcasesort($names);

  foreach ($names as $key => $name) {
    $type = $types[$key];
    $type_url_str = str_replace('_', '-', $type->type);
    $row = array(theme('label_machine_name__node_type', array(
      'label' => $name,
      'machine_name' => $type->type,
    )));
    $row[] = filter_xss_admin($type->description);
    $links = array();
    $links['configure'] = array(
      'title' => t('Configure'),
      'href' => 'admin/structure/types/manage/' . $type_url_str,
      'weight' => 0,
    );
    if ($field_ui) {
      $links['fields'] = array(
        'title' => t('Manage fields'),
        'href' => 'admin/structure/types/manage/' . $type_url_str . '/fields',
        'weight' => 5,
      );
      $links['display'] = array(
        'title' => t('Manage displays'),
        'href' => 'admin/structure/types/manage/' . $type_url_str . '/display',
        'weight' => 10,
      );
    }
    if ($type->module === 'node') {
      $links['delete'] = array(
        'title' => t('Delete'),
        'href' => 'admin/structure/types/manage/' . $type_url_str . '/delete',
        'weight' => 15,
      );
    }
    $row[] = array(
      'data' => array(
        '#type' => 'operations',
        '#links' => $links,
      ),
    );

    $rows[] = $row;
  }

  $build['node_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No content types available. <a href="@link">Add content type</a>.', array('@link' => url('admin/structure/types/add'))),
  );

  return $build;
}