3 namespace Drupal\entity_browser\Wizard;
5 use Drupal\Core\DependencyInjection\ClassResolverInterface;
6 use Drupal\Core\Entity\EntityManagerInterface;
7 use Drupal\Core\Form\FormBuilderInterface;
8 use Drupal\Core\Routing\RouteMatchInterface;
9 use Drupal\ctools\Wizard\EntityFormWizardBase;
10 use Drupal\entity_browser\Form\DisplayConfig;
11 use Drupal\entity_browser\Form\GeneralInfoConfig;
12 use Drupal\entity_browser\Form\SelectionDisplayConfig;
13 use Drupal\entity_browser\Form\WidgetsConfig;
14 use Drupal\entity_browser\Form\WidgetSelectorConfig;
15 use Drupal\user\SharedTempStoreFactory;
16 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
19 * Custom form wizard for entity browser configuration.
21 class EntityBrowserWizard extends EntityFormWizardBase {
24 * @param \Drupal\user\SharedTempStoreFactory $tempstore
25 * Tempstore Factory for keeping track of values in each step of the
27 * @param \Drupal\Core\Form\FormBuilderInterface $builder
29 * @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
31 * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
32 * The event dispatcher.
33 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
35 * @param $tempstore_id
36 * The shared temp store factory collection name.
37 * @param null $machine_name
38 * The SharedTempStore key for our current wizard values.
40 * The current active step of the wizard.
42 public function __construct(SharedTempStoreFactory $tempstore, FormBuilderInterface $builder, ClassResolverInterface $class_resolver, EventDispatcherInterface $event_dispatcher, EntityManagerInterface $entity_manager, RouteMatchInterface $route_match, $tempstore_id, $entity_browser = NULL, $step = 'general') {
43 parent::__construct($tempstore, $builder, $class_resolver, $event_dispatcher, $entity_manager, $route_match, $tempstore_id, $entity_browser, $step);
49 public function getNextParameters($cached_values) {
50 $parameters = parent::getNextParameters($cached_values);
51 $parameters['entity_browser'] = $parameters['machine_name'];
52 unset($parameters['machine_name']);
59 public function getPreviousParameters($cached_values) {
60 $parameters = parent::getPreviousParameters($cached_values);
61 $parameters['entity_browser'] = $parameters['machine_name'];
62 unset($parameters['machine_name']);
69 public function getWizardLabel() {
70 return $this->t('Entity browser');
76 public function getMachineLabel() {
77 return $this->t('Label');
83 public function getEntityType() {
84 return 'entity_browser';
90 public function exists() {
91 return 'Drupal\entity_browser\Entity\EntityBrowser::load';
97 public function getOperations($cached_values) {
100 'title' => $this->t('General information'),
101 'form' => GeneralInfoConfig::class,
104 'title' => $this->t('Display'),
105 'form' => DisplayConfig::class,
107 'widget_selector' => [
108 'title' => $this->t('Widget selector'),
109 'form' => WidgetSelectorConfig::class,
111 'selection_display' => [
112 'title' => $this->t('Selection display'),
113 'form' => SelectionDisplayConfig::class,
116 'title' => $this->t('Widgets'),
117 'form' => WidgetsConfig::class,