You are here

function content_type_groups_admin in Content type groups 7.2

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

Main admin (list) page for content type groups callback.

1 string reference to 'content_type_groups_admin'
ContentTypeGroupUIController::hook_menu in ./content_type_groups.controller.inc
Overrides hook_menu() defaults.

File

./content_type_groups.admin.inc, line 10
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 = entity_load(CONTENT_TYPE_GROUPS_ENTITY_NAME);
  dpm($content_type_groups);
  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'), CONTENT_TYPE_GROUPS_ADMIN_PATH . '/manage/' . $group->type);
    $columns[] = l(t('delete'), CONTENT_TYPE_GROUPS_ADMIN_PATH . '/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;
}