By bsuttis on
I'm trying to alter a fieldset's weight using hook_form_alter(). Every other value (#title, #maxlength, #type) alters as expected, however, the fieldset's weight will not! Is altering the weight of a fieldset more complicated? Even altering the weight of a field is working without issue.
Here's my code:
/**
* Implementation of hook_form_alter().
*/
function misc_form_alter(&$form, $form_state, $form_id) {
if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
$form['translation']['#weight'] = -1;
}
}
Comments
Re:Altering fieldset weight
Hi,
I tried to change the weight of form field using hook_form_alter(). For me its changing as I expected.
I think some problem is in your if condition. You first print your form id and see the value of form id.
suppose form id is xyz, means match $form_id with xyz. Ex. if($form_id=='xyz') and then write statement to
change the weight of your translation field.