Frage

Wenn ich ein Modul erstelle und zwei benutzerdefinierte Pfade haben möchte:

Pfad/path/path/index.htm (Aufrufe Drupal_get_form)

und posten zu

Pfad/Pfad/Pfad/Ergebnis.htm

Wie machst du das? Ich bekomme einen 404 auf dem zweiten Weg. Ich bekomme die Form und was ich will, mit dem ersten Weg leicht genug. Ich möchte nur die Formulare als Drupal -Tabelle thematisieren und hier anzeigen.

War es hilfreich?

Lösung 2

Ich habs. Implementiert Ahah und all das. Ich habe einen Parameter in meinem Rückruf vergessen.

Andere Tipps

Das sieht nach einer guten Wette aus: http://drupal.org/node/290462

<?php
/**
* Implementation of hook_form_alter().
*/
function jm_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['#node']) && $form['#node']->type .'_node_form' == $form_id) {
    $form['buttons']['submit']['#submit'][] = 'jm_redirect_handler';
  }
}

/**
* Attaches the redirect to the submitted form.
*
* @param unknown_type $form
* @param unknown_type $form_state
* @return unknown
*/
function jm_redirect_handler($form, &$form_state) {
  if ($form_state['nid']) {
    // reloading as I do not know the node type context. You probably do not need to :), just set the redirect using $form_state['nid']
    $node = node_load(array('nid' => $form_state['nid']));
    switch($node->type) {
      case 'project':
        $form_state['redirect'] = 'projects/'. $node->nid;
    }
  }
}
?>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top