You are here

public static function BackgroundImageForm::create in Background Image 2.0.x

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

Parameters

\Drupal\background_image\BackgroundImageInterface $background_image:

array $complete_form:

\Drupal\Core\Form\FormStateInterface $form_state:

array $subform:

Return value

\Drupal\background_image\Form\BackgroundImageForm

File

src/Form/BackgroundImageForm.php, line 89

Class

BackgroundImageForm

Namespace

Drupal\background_image\Form

Code

public static function create(BackgroundImageInterface $background_image, array &$complete_form, FormStateInterface $form_state, array &$subform) {
  $self = $form_state
    ->get(self::class);
  if (!$self) {
    $self = new self();
    $form_state
      ->set(self::class, $self);
  }
  return $self
    ->setInlineEntity($form_state
    ->get('inline_entity_form_entity'))
    ->setBackgroundImage($background_image)
    ->setSubform($subform)
    ->setForm($complete_form)
    ->setFormState($form_state);
}