Domanda

Se sto realizzando un modulo e voglio avere due percorsi personalizzati:

Path/Path/Path/Index.htm (chiama drupal_get_form)

e pubblicare a

Path/Path/Path/Result.htm

Come si fa a farlo? Ottengo un 404 sul secondo percorso. Ottengo la forma e quello che voglio con il primo percorso abbastanza facilmente. Tutto quello che voglio fare è il tema i risultati del modulo come tabella Drupal e mostrarlo qui.

È stato utile?

Soluzione 2

Fatto. Implementato ahah e tutto il resto. Ho dimenticato un parametro nel mio callback.

Altri suggerimenti

Sembra una buona scommessa: 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;
    }
  }
}
?>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top