Move form element


/ Published in: PHP
Save to your folder(s)

Move form element into category. Helper for organizing the form


Copy this code and paste it in your HTML
  1. function move_form_element(&$form, $name, $new_category, $weight = NULL)
  2. {
  3. $form[$new_category][$name] = $form[$name];
  4. if($weight != NULL)
  5. {
  6. $form[$new_category][$name]['#weight'] = $weight;
  7. }
  8. unset($form[$name]);
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.