function fieldset_helper_state_manager_get_state in Fieldset helper 6.2
Same name and namespace in other branches
- 6 fieldset_helper.module \fieldset_helper_state_manager_get_state()
- 7.2 fieldset_helper.module \fieldset_helper_state_manager_get_state()
Get fieldset's collapsed state.
Parameters
$element_id: The DOM element id.
$default_value: Boolean for default state value
1 call to fieldset_helper_state_manager_get_state()
- fieldset_helper_alter_theme_fieldset in ./
fieldset_helper.theme.inc - Alters a fieldset element to set default attributes, state, and id.
File
- ./
fieldset_helper.module, line 380
Code
function fieldset_helper_state_manager_get_state($element_id, $default_value = FALSE) {
// Always return the default value is state management is disabled for anonymous.
if (user_is_anonymous() && variable_get('fieldset_helper_disable_state_anonymous', 0) == 1) {
return $default_value;
}
// Get fieldset states and lookup ids
$states = fieldset_helper_state_manager_get_cookie_states();
$lookup_id = fieldset_helper_state_manager_get_lookup_id($element_id);
// Return collapsed boolean value.
if (isset($states[$lookup_id])) {
return $states[$lookup_id] ? TRUE : FALSE;
}
else {
return $default_value ? TRUE : FALSE;
}
}