public function BackgroundImageForm::build in Background Image 8
Same name and namespace in other branches
- 2.x src/Form/BackgroundImageForm.php \Drupal\background_image\Form\BackgroundImageForm::build()
- 2.0.x src/Form/BackgroundImageForm.php \Drupal\background_image\Form\BackgroundImageForm::build()
Builds the Background Image form.
File
- src/
Form/ BackgroundImageForm.php, line 104
Class
Namespace
Drupal\background_image\FormCode
public function build() {
// Add necessary handlers.
self::attachValidationHandler([
self::class,
'staticValidate',
], $this->form, $this->formState);
self::attachSubmitHandler([
self::class,
'staticSubmit',
], $this->form, $this->formState);
switch ($this->step) {
// Type selection.
case 1:
$this
->buildTypeSelection();
break;
// Complete form.
case 2:
// Begin constructing the form. Use vertical tabs if this is not embedded
// on another entity form.
$this->subform['vertical_tabs'] = [
'#type' => 'vertical_tabs',
'#access' => !$this->inlineEntity,
];
// Image.
$this
->buildImage($this
->createGroup('image_group', $this->subform, [
'#title' => $this
->t('Image'),
'#group' => $this->inlineEntity ? NULL : 'vertical_tabs',
'#type' => $this->inlineEntity ? 'container' : 'details',
'#weight' => 10,
]));
// Settings.
$this
->buildSettings();
break;
}
}