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)