You are here

function content_type_groups_admin in Content type groups 7

Same name and namespace in other branches
  1. 7.2 content_type_groups.admin.inc \content_type_groups_admin()

@file Admin page callback file for the Content type groups module.

1 string reference to 'content_type_groups_admin'
content_type_groups_menu in ./content_type_groups.module
Implements hook_menu().

File

./content_type_groups.admin.inc, line 7
Admin page callback file for the Content type groups module.

Code

function content_type_groups_admin() {
  $output = '';
  $header = array(
    t('Name'),
    t('Content Types'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  $content_type_groups = ContentTypeGroup::fetch(TRUE);
  foreach ($content_type_groups as $group) {
    $columns = array();
    $columns[] = $group->name;
    $columns[] = count($group->content_types) ? implode(', ', $group
      ->typeList()) : 'No content types defined for this group.';
    $columns[] = l(t('edit'), 'admin/structure/types/groups/manage/' . $group->type);
    $columns[] = l(t('delete'), 'admin/structure/types/groups/manage/' . $group->type . '/delete');
    $rows[] = $columns;
  }
  $build['content_type_groups_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No content type groups available. <a href="@link">Add content type group</a>.', array(
      '@link' => url('admin/structure/types/groups/add'),
    )),
  );
  return $build;
}