Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Feb 12, 2025
1 parent a16b068 commit 6f8d215
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Field/Configurator/BooleanConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c

$hasEditPermission = $this->authChecker->isGranted(Permission::EA_EXECUTE_ACTION, ['action' => Action::EDIT, 'entity' => $entityDto]);

if (null !== $crudDto && null !== $entityDto->getPrimaryKeyValue() && $hasEditPermission) {
if ($hasEditPermission && null !== $crudDto && null !== $entityDto->getPrimaryKeyValue()) {
$toggleUrl = $this->adminUrlGenerator
->setController($crudDto->getControllerFqcn())
->setAction(Action::EDIT)
Expand All @@ -50,7 +50,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
$field->setCustomOption(BooleanField::OPTION_TOGGLE_URL, $toggleUrl);
}

if (Action::INDEX === $crudDto->getCurrentAction() && !$hasEditPermission) {
if (!$hasEditPermission && Action::INDEX === $crudDto->getCurrentAction()) {
$field->setFormTypeOptionIfNotSet('disabled', true);
}

Expand Down

0 comments on commit 6f8d215

Please sign in to comment.