Drupal: How to render a form and table on same page

Posted by Aaron on Stack Overflow See other posts from Stack Overflow or by Aaron
Published on 2010-04-22T15:39:57Z Indexed on 2010/04/22 15:43 UTC
Read the original article Hit count: 202

Filed under:
|
|

Can someone help me render a form and table on the same page? I'm sure it's easy, but can't think of how to do it.

Here's hook_menu:

 function ncbi_subsites_menu() {
        $items = array();

        $items['admin/content/ncbi_subsites'] = array(
            'title' => 'NCBI Subsites Module',
            'description' => 'Informs Drupal about NCBI subsites as defined by the Content Inventory database',
            'page callback' => 'ncbi_subsites_show_main_page',
            'access arguments' => array( 'administer site configuration' ),
            'type' => MENU_NORMAL_ITEM,
        );
        return $items;
}

Here's the callback:

function ncbi_subsites_show_main_page() {
    $subsites = ncbi_subsites_get_subsites_from_inventory(); // fnc returns associative array from inventory, defined in include
    return ncbi_subsites_make_table( $subsites );
}

In the callback I call some helper functions that return a themed, paged table.

What I want is a small form above the table. How would I that?

© Stack Overflow or respective owner

Related posts about drupal

Related posts about forms