Inicio › API reference ›
hook_form_alter
hooks/core.php, line 717
- Versions
- hooks
hook_form_alter(&$form, $form_state, $form_id)
Perform alterations before a form is rendered.
One popular use of this hook is to add form elements to the node form. When altering a node form, the node object retrieved at from $form['#node'].
Parameters
$form Nested array of form elements that comprise the form.
$form_state A keyed array containing the current state of the form.
$form_id String representing the name of the form itself. Typically this is the name of the function that generated the form.
Valor de retorno
None.
Código
<?php
function hook_form_alter(&$form, $form_state, $form_id) {
if ('node_type_form' == $form_id) {
$form['workflow']['upload'] = array(
'#type' => 'radios',
'#title' => t('Attachments'),
'#default_value' => variable_get('upload_'. $form['#node_type']->type, 1),
'#options' => array(t('Disabled'), t('Enabled')),
);
}
}
?> 
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