Created
July 3, 2015 09:42
-
-
Save mootari/a612bee947d77b6d4d77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function MODULE_my_form($form, &$form_state) { | |
| // ... | |
| $form['#pre_render'][] = 'MODULE_my_form_add_table'; | |
| return $form; | |
| } | |
| function MODULE_my_form_add_table($form) { | |
| $table_fields = array('one', 'two'); | |
| $table = array( | |
| '#prefix' => '<table>', | |
| '#suffix' => '</table>', | |
| ); | |
| foreach($table_fields as $name) { | |
| if(isset($form[$name])) { | |
| $table[$name] = array( | |
| '#prefix' => '<tr><td>', | |
| '#suffix' => '</td></tr>', | |
| ) + $form[$name]; | |
| unset($form[$name]); | |
| } | |
| } | |
| $form['table'] = $table; | |
| return $form; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment