DefaultWizardOperation.php in Flexiform 8
File
contrib/wizard/src/Form/DefaultWizardOperation.php
View source
<?php
namespace Drupal\flexiform_wizard\Form;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DefaultWizardOperation extends FormBase {
protected $entityTypeManager;
protected $wizardConfig = NULL;
protected $step = '';
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager'));
}
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
public function getFormDisplay() {
$id = 'flexiform_wizard.' . $this->wizardConfig
->id() . '.' . $this->step;
$display = $this->entityTypeManager
->getStorage('entity_form_display')
->load($id);
return $display;
}
public function buildForm(array $form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
$this
->getFormDisplay()
->buildAdvancedForm($cached_values['entities'], $form, $form_state);
return $form;
}
public function submitForm(array $form, FormStateInterface $form_state) {
}
}