Inicio › API reference ›
hook_forms
hooks/core.php, line 778
- Versions
- hooks
hook_forms()
Map form_ids to builder functions.
This hook allows modules to build multiple forms from a single form "factory" function but each form will have a different form id for submission, validation, theming or alteration by other modules.
The callback arguments will be passed as parameters to the function. Callers of drupal_get_form() are also able to pass in parameters. These will be appended after those specified by hook_forms().
See node_forms() for an actual example of how multiple forms share a common building function.
Valor de retorno
An array keyed by form id with callbacks and optional, callback arguments.
Código
<?php
function hook_forms() {
$forms['mymodule_first_form'] = array(
'callback' => 'mymodule_form_builder',
'callback arguments' => array('some parameter'),
);
$forms['mymodule_second_form'] = array(
'callback' => 'mymodule_form_builder',
);
return $forms;
}
?> 
Comentarios recientes
hace 17 horas 50 mins
hace 1 día 10 horas
hace 1 semana 21 horas
hace 14 semanas 4 días
hace 19 semanas 19 horas
hace 20 semanas 2 días
hace 20 semanas 5 días
hace 20 semanas 5 días
hace 21 semanas 2 días
hace 22 semanas 1 día