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('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('node_admin_overview', array('name' => $name, 'type' => $type)));
    $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;
}