Guest User

Untitled

a guest
May 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. function site_form_alter(&$form, $form_state, $form_id) {
  2.     $horizontal_form_ids = array('forward_form');
  3.    
  4.     if (in_array($form_id, $horizontal_form_ids)) {
  5.         site_make_form_elements_hozontal(&$form);
  6.     }
  7. }
  8.  
  9. function site_make_form_elements_hozontal(&$form) {
  10.     $horizontal_types = array('textfield', 'textarea');  // the #type attribute
  11.     site_apply_attribute($form, $horizontal_types);
  12. }
  13.  
  14.  
  15. function site_apply_attribute(&$tree, $horizontal_types) {
  16.     foreach (element_children($tree) as $key => $value) {
  17.         if (isset($tree[$value]['#type']) && in_array($tree[$value]['#type'], $horizontal_types)) {
  18. dsm('apply to ' . $data['#type']);
  19.         } else if (is_array($tree[$value])) {
  20.             site_apply_attribute($tree, $horizontal_types);
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment