You are here

public function BackgroundImageFormTrait::setSubformState in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/BackgroundImageFormTrait.php \Drupal\background_image\BackgroundImageFormTrait::setSubformState()
  2. 2.x src/BackgroundImageFormTrait.php \Drupal\background_image\BackgroundImageFormTrait::setSubformState()

Sets the subform state, if one exists.

Return value

self

2 calls to BackgroundImageFormTrait::setSubformState()
BackgroundImageForm::setSubformState in src/Form/BackgroundImageForm.php
BackgroundImageFormTrait::setFormState in src/BackgroundImageFormTrait.php
Sets the current FormState object.

File

src/BackgroundImageFormTrait.php, line 641

Class

BackgroundImageFormTrait
Trait BackgroundImageFormTrait.

Namespace

Drupal\background_image

Code

public function setSubformState() {
  $this->subformState = NULL;
  $this->subformValues = [];
  if (isset($this->subform) && isset($this->form) && isset($this->formState)) {
    $this->subformState = SubformState::createForSubform($this->subform, $this->form, $this->formState);
    $this->subformValues = $this->subformState
      ->getValues();
  }
  return $this;
}