wizardFactory = $wizard_factory; } /** * {@inheritdoc} */ protected function getFormArgument(RouteMatchInterface $route_match) { return $route_match->getRouteObject()->getDefault('_wizard'); } /** * Wizards are not instantiated as simply as forms, so this method is unused. */ protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { if (!is_subclass_of($form_arg, '\Drupal\ctools\Wizard\FormWizardInterface')) { throw new \Exception("The _wizard default must reference a class instance of \\Drupal\\ctools\\Wizard\\FormWizardInterface."); } $parameters = $route_match->getParameters()->all(); $parameters += $form_arg::getParameters(); $parameters['route_match'] = $route_match; return $this->wizardFactory->createWizard($form_arg, $parameters); } /** * {@inheritdoc} */ public function getContentResult(Request $request, RouteMatchInterface $route_match) { $wizard = $this->getFormObject($route_match, $this->getFormArgument($route_match)); $ajax = $request->attributes->get('js') == 'ajax' ? TRUE : FALSE; return $this->wizardFactory->getWizardForm($wizard, $request->attributes->all(), $ajax); } }