Created
November 21, 2012 17:38
-
-
Save kid-icarus/4126352 to your computer and use it in GitHub Desktop.
recursive slam dunk
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
/** | |
* Adds an #ajax property recursively to all elements of a form. | |
* | |
* @param array $element | |
* The first element to recursively apply #ajax to. | |
*/ | |
function recursive_ajax(&$element) { | |
if (element_children($element)) { | |
foreach (element_children($element) as $child) { | |
recursive_ajax($element[$child]); | |
} | |
$element['#ajax'] = array( | |
'wrapper' => 'stuff', | |
'callback' => 'stuff again', | |
'method' => 'replace', | |
); | |
} | |
else { | |
$element['#ajax'] = array( | |
'wrapper' => 'stuff', | |
'callback' => 'stuff again', | |
'method' => 'replace', | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what a simply beautiful dance