function privatemsg_account_fieldset_remove_if_empty in Privatemsg 6.2
Same name and namespace in other branches
- 7.2 privatemsg.module \privatemsg_account_fieldset_remove_if_empty()
- 7 privatemsg.module \privatemsg_account_fieldset_remove_if_empty()
Hides the settings fieldset if there are no options to be displayed.
1 string reference to 'privatemsg_account_fieldset_remove_if_empty'
File
- ./
privatemsg.module, line 1420 - Allows users to send private messages to other users.
Code
function privatemsg_account_fieldset_remove_if_empty($element) {
// If there are no children elements, deny access.
if (count(element_children($element)) == 0) {
$element['#access'] = FALSE;
}
else {
// If there are elements, check if at least one of them is visible. Deny
// access.
foreach (element_children($element) as $key) {
if ($element[$key]['#type'] != 'value' && (!isset($element[$key]['#access']) || $element[$key]['#access'])) {
return $element;
}
}
$element['#access'] = FALSE;
}
return $element;
}