Last active
May 5, 2017 11:07
-
-
Save mootari/9d2de5140dac7db7bb08de55714e6159 to your computer and use it in GitHub Desktop.
Drupal 7: Workaround for validation errors for same fields in multiple forms on the same page.
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_form_alter($form) { | |
$form['#pre_render'][] = 'MODULE_wrap_elements'; | |
} | |
function MODULE_wrap_elements($form) { | |
foreach(element_children($form) as $name) { | |
$form[$name] += array('#parents' => array()); | |
array_unshift($form[$name]['#parents'], 'container'); | |
} | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment