2010-05-10 11 views
0

Si je fais un module, et que vous voulez avoir deux chemins personnalisés:Enregistrement de chemins de menus Drupal?

chemin/chemin/chemin/index.htm (appels drupal_get_form)

et poster à

chemin/chemin/sentier /result.htm

Comment faites-vous cela? Je reçois un 404 sur le deuxième chemin. Je reçois la forme et ce que je veux avec le premier chemin assez facilement. Tout ce que je veux faire est de thématiser les résultats du formulaire sous forme de tableau drupal et l'afficher ici.

Répondre

0

Got it. Implémenté AHAH et tout ça. J'ai oublié un paramètre dans mon rappel.

1

Cela ressemble à un bon pari: 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; 
    } 
    } 
} 
?>