Fix form with mulitple buttons doesn't recognize whether it's been submitted

This commit is contained in:
Yonas Habteab 2023-09-11 15:52:56 +02:00 committed by Johannes Meyer
parent 192a21b668
commit fdadba59ca
1 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,16 @@ class MigrationForm extends Form
'name' => 'migration-form'
];
public function hasBeenSubmitted(): bool
{
if (! $this->hasBeenSent()) {
return false;
}
$pressedButton = $this->getPressedSubmitElement();
return $pressedButton && strpos($pressedButton->getName(), 'migrate-') !== false;
}
protected function assemble(): void
{
$this->addHtml($this->createUidElement());