Question

Si je fais un module, et que vous voulez avoir deux chemins personnalisés:

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

et après à

path / chemin / chemin / result.htm

Comment faites-vous cela? Je reçois un 404 sur la deuxième voie. 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ème les résultats forment comme une table et l'afficher drupal ici.

Était-ce utile?

La solution 2

Got it. Mis en œuvre AHAH et tout cela. Vous avez oublié un paramètre dans mon rappel.

Autres conseils

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;
    }
  }
}
?>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top