diff --git a/composer.json b/composer.json index 9e260c5..60030e4 100644 --- a/composer.json +++ b/composer.json @@ -90,5 +90,12 @@ "@chain", "yarn build" ] + }, + "config": { + "allow-plugins": { + "contao-components/installer": true, + "bamarni/composer-bin-plugin": true, + "contao/manager-plugin": true + } } } diff --git a/src/Controller/DisplayRecordsController.php b/src/Controller/DisplayRecordsController.php index d85f305..df0cb82 100644 --- a/src/Controller/DisplayRecordsController.php +++ b/src/Controller/DisplayRecordsController.php @@ -46,8 +46,7 @@ public function question(Request $request, int $id): Response throw $this->createAccessDeniedException(); } - $stateParameter = $request->get('state'); - $overwriteState = null !== $stateParameter ? (bool) $stateParameter : null; + $overwriteState = $request->query->has('state') ? (bool) $request->query->get('state') : null; /** @var Question|null $question */ $question = $this->questionRepository->find($id); diff --git a/src/Controller/SurveyFragment.php b/src/Controller/SurveyFragment.php index d6f29f0..7267911 100644 --- a/src/Controller/SurveyFragment.php +++ b/src/Controller/SurveyFragment.php @@ -22,6 +22,7 @@ use Mvo\ContaoSurvey\Form\SurveyManagerFactory; use Mvo\ContaoSurvey\Registry; use Mvo\ContaoSurvey\Repository\SurveyRepository; +use Symfony\Component\Form\SubmitButton; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -127,14 +128,20 @@ private function proceedUntilCompleted(SurveyManager $manager): bool } // reset (back to the first step) - if ($manager->form['reset']->isClicked()) { + /** @var SubmitButton $resetButton */ + $resetButton = $manager->form['reset']; + + if ($resetButton->isClicked()) { $manager->reset(); return false; } // back to the previous step - if (isset($manager->form['previous']) && $manager->form['previous']->isClicked() && $manager->previousStep()) { + /** @var SubmitButton|null $backButton */ + $backButton = $manager->form['previous'] ?? null; + + if ($backButton && $backButton->isClicked() && $manager->previousStep()) { return false; } diff --git a/src/DependencyInjection/Compiler/RegisterSessionStoragePass.php b/src/DependencyInjection/Compiler/RegisterSessionStoragePass.php deleted file mode 100644 index fecc5df..0000000 --- a/src/DependencyInjection/Compiler/RegisterSessionStoragePass.php +++ /dev/null @@ -1,27 +0,0 @@ -hasDefinition('session')) { - return; - } - - $session = $container->findDefinition('session'); - $session->addMethodCall('registerBag', [new Reference('mvo.survey.session_storage')]); - } -} diff --git a/src/MvoContaoSurveyBundle.php b/src/MvoContaoSurveyBundle.php index 653448a..a586c53 100644 --- a/src/MvoContaoSurveyBundle.php +++ b/src/MvoContaoSurveyBundle.php @@ -9,7 +9,6 @@ namespace Mvo\ContaoSurvey; -use Mvo\ContaoSurvey\DependencyInjection\Compiler\RegisterSessionStoragePass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -18,7 +17,5 @@ class MvoContaoSurveyBundle extends Bundle public function build(ContainerBuilder $container): void { parent::build($container); - - $container->addCompilerPass(new RegisterSessionStoragePass()); } }