Drupal: Wie Render-Ergebnisse von Formular auf Derselben Seite wie Form

Wie kann ich drucken Sie die Ergebnisse des Formulars auf der selben Seite wie das Formular selbst?

Relevanten hook_menu:

    $items['admin/content/ncbi_subsites/paths'] = array(
        'title' => 'Paths',
        'description' => 'Paths for a particular subsite',
        'page callback' => 'ncbi_subsites_show_path_page',
        'access arguments' => array( 'administer site configuration' ),
        'type' => MENU_LOCAL_TASK,
    );

Seite callback:

function ncbi_subsites_show_path_page() {
  $f = drupal_get_form('_ncbi_subsites_show_paths_form');
  return $f;
}

Formbildenden Funktion:

   function _ncbi_subsites_show_paths_form() {
      //bunch of code here

      $form['subsite'] = array(
        '#title' => t('Subsites'),
        '#type' => 'select',
        '#description' => 'Choose a subsite to get its paths',
        '#default_value' => 'Choose a subsite',
        '#options'=> $tmp,
      );

      $form['showthem'] = array(
        '#type' => 'submit',
        '#value' => 'Show paths',
        '#submit' => array( 'ncbi_subsites_show_paths_submit'),    
      );

      return $form;
    }

Submit-Funktion (übersprungen validate-Funktion für die Kürze)

function ncbi_subsites_show_paths_submit( &$form, &$form_state ) {
  //dpm ( $form_state );
  $subsite_name = $form_state['values']['subsite'];
  $subsite = new Subsite( $subsite_name ); //y own class that I use internally in this module
  $paths = $subsite->normalized_paths;

  //build list
  $list = theme_item_list( $paths );
}

Wenn ich print $Liste variable, es ist genau das, was ich will, aber ich bin mir nicht sicher, wie man es in die Seite mit der ursprünglichen form Seite gebaut von 'ncbi_subsites_show_path_page'. Jede Hilfe ist sehr willkommen!

InformationsquelleAutor Aaron | 2010-04-28
Schreibe einen Kommentar