function fieldset_helper_state_manager_get_cookie_states in Fieldset helper 6
Same name and namespace in other branches
- 6.2 fieldset_helper.module \fieldset_helper_state_manager_get_cookie_states()
- 7.2 fieldset_helper.module \fieldset_helper_state_manager_get_cookie_states()
Get an associated array for lookup id and the element's state (1 or 0) from $_COOKIE['fieldset_helper_state_manager'].
Parameters
$clear: Optional boolean when set to TRUE will clear any cached cookie states.
2 calls to fieldset_helper_state_manager_get_cookie_states()
- FieldsetHelperTestCase::setFieldsetHelperStateManagerCookie in ./
fieldset_helper.test - Resets the Fieldset helper state manager cookies value for every loaded fieldset.
- fieldset_helper_state_manager_get_state in ./
fieldset_helper.module - Get fieldset's collapsed state.
File
- ./
fieldset_helper.module, line 390 - Saves the collapsed state of a Drupal collapsible fieldset.
Code
function fieldset_helper_state_manager_get_cookie_states($clear = FALSE) {
static $states;
if (isset($states) && $clear == FALSE) {
return $states;
}
$states = array();
if (!isset($_COOKIE['fieldset_helper_state_manager'])) {
return $states;
}
else {
$values = explode('_', $_COOKIE['fieldset_helper_state_manager']);
foreach ($values as $value) {
$params = explode('.', $value);
$states[$params[0]] = $params[1] == '1' ? TRUE : FALSE;
}
return $states;
}
}