You are here

public function SubFormState::__construct in Authorization 8

Constructs a SubFormState object.

Parameters

\Drupal\Core\Form\FormStateInterface $main_form_state: The state of the main form.

string[] $sub_keys: The keys that lead to the desired sub-form in the main form.

File

src/Form/SubFormState.php, line 81

Class

SubFormState
Represents the form state of a sub-form.

Namespace

Drupal\authorization\Form

Code

public function __construct(FormStateInterface $main_form_state, array $sub_keys) {
  $this->mainFormState = $main_form_state;
  $this->subKeys = $sub_keys;
  $sub_state =& $main_form_state
    ->get('sub_states');
  if (!isset($sub_state)) {
    $sub_state = [];
  }
  $this->internalStorage =& $this
    ->applySubKeys($sub_state);
  if (!isset($this->internalStorage)) {
    $this->internalStorage = [];
  }
  $this->values =& $this
    ->applySubKeys($main_form_state
    ->getValues());
  if (!is_array($this->values)) {
    $this->values = [];
  }
  $this->input =& $this
    ->applySubKeys($main_form_state
    ->getUserInput());
  if (!is_array($this->input)) {
    $this->input = [];
  }
}