From faa7730e94d39101f157bcfead1dc3d567e4ee46 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 4 Jan 2025 19:52:47 +0100 Subject: [PATCH] Tweak --- src/Field/Configurator/BooleanConfigurator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Field/Configurator/BooleanConfigurator.php b/src/Field/Configurator/BooleanConfigurator.php index 1d71c8821a..fbc3a3ff81 100644 --- a/src/Field/Configurator/BooleanConfigurator.php +++ b/src/Field/Configurator/BooleanConfigurator.php @@ -35,10 +35,9 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c $isRenderedAsSwitch = true === $field->getCustomOption(BooleanField::OPTION_RENDER_AS_SWITCH); if ($isRenderedAsSwitch) { - $crudDto = $context->getCrud(); - if (null !== $crudDto && Action::NEW !== $crudDto->getCurrentAction()) { + if (null !== $crudDto && null !== $entityDto->getPrimaryKeyValue()) { $toggleUrl = $this->adminUrlGenerator ->setController($crudDto->getControllerFqcn()) ->setAction(Action::EDIT)