You are here

function subform_get_parent_state in Subform 7

Returns the form state of a subform's parent form.

Parameters

$subform_state: A keyed array containing the current state of the subform.

Return value

The state of subform's parent form.

File

./subform.module, line 735
Defines a subform element type.

Code

function subform_get_parent_state($subform_state) {
  if (!empty($subform_state['subform_name'])) {
    if (isset($subform_state['temporary']['subform_parent_state'])) {
      return $subform_state['temporary']['subform_parent_state'];
    }
    elseif ($cached = cache_get('form_state_' . $subform_state['subform_parent']['build_id'], 'cache_form')) {
      return $cached->data + form_state_defaults();
    }
  }
  return FALSE;
}