Skip to content

Commit

Permalink
feature #5927 Hide field from Configurator (Alexandar Bozhinov)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.x branch.

Discussion
----------

Hide field from Configurator

I create Configurators based on entities, and in some cases, I need to remove fields based on certain conditions, which are set within the Configurator.

Commits
-------

b699377 Hide field from Configurator
  • Loading branch information
javiereguiluz committed Sep 18, 2023
2 parents 1969e20 + b699377 commit 12cc0e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Factory/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public function processFields(EntityDto $entityDto, FieldCollection $fields): vo
$configurator->configure($fieldDto, $entityDto, $context);
}

// check again if the field is displayed because this can change in the configurators
if (null !== $currentPage && false === $fieldDto->isDisplayedOn($currentPage)) {
$fields->unset($fieldDto);
continue;
}

foreach ($fieldDto->getFormThemes() as $formThemePath) {
$context?->getCrud()?->addFormTheme($formThemePath);
}
Expand Down

0 comments on commit 12cc0e9

Please sign in to comment.