You are here

public function FlexiformBuilderFlexiform::getFlexiformState in Flexiform 7

Get the flexiform state.

Parameters

array $form: The form array being built. Must have a parents key.

array $form_state: The form_State array.

Return value

array The flexiform state.

3 calls to FlexiformBuilderFlexiform::getFlexiformState()
FlexiformBuilderFlexiform::form in includes/builder/flexiform.builder.inc
Build the form for this flexiform.
FlexiformBuilderFlexiform::formSubmit in includes/builder/flexiform.builder.inc
Submit the form.
FlexiformBuilderFlexiform::formValidate in includes/builder/flexiform.builder.inc
Validate the input for the form.

File

includes/builder/flexiform.builder.inc, line 77
Contains the FlexiformBuilderFlexiform Class

Class

FlexiformBuilderFlexiform
Flexiform Builder Class for the complex flexiforms.

Code

public function &getFlexiformState($form, &$form_state) {

  // Shortcut if we've already got the array.
  if (is_array($this->flexiformState)) {
    return $this->flexiformState;
  }

  // Set up a place to safely store information in the form state.
  if (empty($form_state['flexiform_state'])) {
    $form_state['flexiform_state'] = array();
  }

  // Get the flexiform state for this particular form. This is a bit involved
  // as we need to be able to nest flexiforms.
  $this->flexiformState = drupal_array_get_nested_value($form_state['flexiform_state'], $form['#parents']);
  if (empty($this->flexiformState)) {
    $this->flexiformState = array();
  }
  return $this->flexiformState;
}