From 11b98e4f60ef2b5f44acec824a19386235f79dba Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 10 Jan 2010 22:45:58 +0000 Subject: #637712 by c960657 and Dave Reid: Fixed Fieldset is back in user registration form. --- includes/common.inc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index ecfd1a4a7..39c1ea14a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -5420,6 +5420,36 @@ function element_children(&$elements, $sort = FALSE) { return array_keys($children); } +/** + * Return the visibile children of an element. + * + * @param $elements + * The parent element. + * @return + * The array keys of the element's visible children. + */ +function element_get_visible_children(array $elements) { + $visible_children = array(); + + foreach (element_children($elements) as $key) { + $child = $elements[$key]; + + // Skip un-accessible children. + if (isset($child['#access']) && !$child['#access']) { + continue; + } + + // Skip value and hidden elements, since they are not rendered. + if (isset($child['#type']) && in_array($child['#type'], array('value', 'hidden'))) { + continue; + } + + $visible_children[$key] = $child; + } + + return array_keys($visible_children); +} + /** * Provide theme registration for themes across .inc files. */ -- cgit v1.2.3