You are here

function fieldset_helper_state_manager_get_state in Fieldset helper 6

Same name and namespace in other branches
  1. 6.2 fieldset_helper.module \fieldset_helper_state_manager_get_state()
  2. 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.module
Theme related function that is used by the phptemplate_fieldset() function (in fieldset_helper.theme.inc) to alter the fieldset so that its collapsible state can be saved.

File

./fieldset_helper.module, line 420
Saves the collapsed state of a Drupal collapsible fieldset.

Code

function fieldset_helper_state_manager_get_state($element_id, $default_value = FALSE) {

  // 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;
  }
}