Skip to content

Commit

Permalink
bug #5704 hideWhenCreating() does not work with useEntryCrudForm() (s…
Browse files Browse the repository at this point in the history
…imoheinonen)

This PR was merged into the 4.x branch.

Discussion
----------

hideWhenCreating() does not work with useEntryCrudForm()

fixes #5696

Commits
-------

8979540 Hide on entry crud form
  • Loading branch information
javiereguiluz committed Apr 21, 2023
2 parents c1139bb + 8979540 commit 8b117bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Factory/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ public function processFields(EntityDto $entityDto, FieldCollection $fields): vo
continue;
}

// when creating new entities with "useEntryCrudForm" on an edit page we must
// explicitly check for the "new" page because $currentPage will be "edit"
if ((null === $entityDto->getInstance()) && !$fieldDto->isDisplayedOn(Crud::PAGE_NEW)) {
$fields->unset($fieldDto);

continue;
}

foreach ($this->fieldConfigurators as $configurator) {
if (!$configurator->supports($fieldDto, $entityDto)) {
continue;
Expand Down

0 comments on commit 8b117bd

Please sign in to comment.