Created
May 20, 2010 21:22
-
-
Save mattfarina/408130 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Helper function; removes all required element flags on a section of a form. | |
* | |
* @param array $element | |
* A form or section of a form. | |
* | |
* @return array | |
* A section of a form tree with #required = 0 everyehere. | |
*/ | |
function example_remove_required($element) { | |
if (isset($element['#required']) && $element['#required'] == 1) { | |
$element['#required'] = 0; | |
} | |
$children = element_children($element); | |
foreach ($children as $key) { | |
$element[$key] = icalfield_ajaxy_remove_required($element[$key]); | |
} | |
return $element; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment