Drupal doesn't output list of children on custom module page I am on Drupal 7. I want to create a page that lists its children, the same way you see the list of links in 'admin/structure' (Blocks, Content types, Entity types ...).

I have modified child 1 and child 2. They aren't really important for this example.

on mymodule.module I have inside function mymodule_menu():

  $items['admin/mymodule'] = array(
    'title' =&gt; 'My module parent page',
    'page callback' =&gt; 'mymodule_admin_page',
    'access callback' =&gt; 'mymodule_admin_list',
    'access arguments' =&gt; array(1),
    'file' =&gt; 'mymodule.admin.inc',
  );

  // Child 1
  $items['admin/mymodule/child1'] = array(
    'title' =&gt; 'Child 1',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('mymodule_something_01', 1),
    'type' =&gt; MENU_NORMAL_ITEM,
    'file' =&gt; 'mymodule.admin.inc',
  );

  // Child 2
  $items['admin/mymodule/child2'] = array(
    'title' =&gt; 'Child 2',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('mymodule_something_02', 1),
    'type' =&gt; MENU_NORMAL_ITEM,
    'file' =&gt; 'mymodule.admin.inc',
  );


Then, on mymodule.admin.inc, I have this function:

function mymodule_admin_page() {
  $item = menu_get_item();
  if ($content = system_admin_menu_block($item)) {
    $output = theme('mymodule_admin_list', array('content' =&gt; $content));        
    // This gets printed on the page
    drupal_set_message('This gets printed on the page');
  }
  else {
    $output = t('You do not have any administrative items.');
    // This doesn't get printed on the page because my base page has children.
    drupal_set_message('This doesnt get printed on the page because my base page has children.');
  }
  return $output;
}


Finally, according to documentation I have read, I should add a function like the one below:

function theme_mymodule_admin_list($variables) {

  $content = $variables['content'];
  $output = '';
  // This doesn't get printed on the page...
  drupal_set_message('this doesnt get printed... Why???');

  if ($content) {
    $output = '&lt;dl class="node-type-list"&gt;';
    foreach ($content as $item) {
      $output .= '&lt;dt&gt;' . l($item['title'], $item['href'], $item['localized_options']) . '&lt;/dt&gt;';
      $output .= '&lt;dd&gt;' . filter_xss_admin($item['description']) . '&lt;/dd&gt;';
    }
    $output .= '&lt;/dl&gt;';
  }

  return $output;
}


Check my drupal_set_message above. Messages on function mymodule_admin_page get printed, but messages on theme_mymodule_admin_list don't get printed... Actually, admin/mymodule responds as a page, but instead of displaying links to its children, it will display a blank page...

I must be missing something, but I really don't know what. Thank you!

========

SOLUTION

I am posting the solution below. Thank you, Geoff, for your comment. It did the trick! I was missing one of the pieces in this puzzle, which was the mymodule_theme function.

function mymodule_theme($existing, $type, $theme, $path) {
  return array(
    'mymodule_admin_list' =&gt; array(
      'variables' =&gt; array('content' =&gt; NULL),
      'file' =&gt; 'mymodule.admin.inc',
    ),
  );
}
Another Solution here would be to do what the admin pages do for those pages

$items['admin/somemodule'] = array(
 'title' =&gt; 'My Module Section',
 'description' =&gt; 'Manage My Module',
 'page callback' =&gt; 'system_admin_menu_block_page',
 'access arguments' =&gt; array('access administration pages'),
 'file path' =&gt; drupal_get_path('module', 'system'),
 'file' =&gt; 'system.admin.inc',
);