Skip to content

Commit 1d23083

Browse files
tbialczalbozek
authored andcommitted
IBX-9060: Allowed custom submit button name in NotificationSelectionType form
1 parent 79131da commit 1d23083

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/lib/Form/Factory/FormFactory.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,11 +1074,17 @@ public function removeContentDraft(
10741074
*/
10751075
public function deleteNotification(
10761076
NotificationSelectionData $data = null,
1077-
?string $name = null
1077+
?string $name = null,
1078+
string $submitName = 'remove'
10781079
): FormInterface {
10791080
$name = $name ?: StringUtil::fqcnToBlockPrefix(NotificationSelectionType::class);
10801081

1081-
return $this->formFactory->createNamed($name, NotificationSelectionType::class, $data);
1082+
return $this->formFactory->createNamed(
1083+
$name,
1084+
NotificationSelectionType::class,
1085+
$data,
1086+
['submit_name' => $submitName]
1087+
);
10821088
}
10831089

10841090
/**

src/lib/Form/Type/Notification/NotificationSelectionType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3333
);
3434

3535
$builder->add(
36-
'remove',
36+
$options['submit_name'],
3737
SubmitType::class
3838
);
3939
}
@@ -42,6 +42,7 @@ public function configureOptions(OptionsResolver $resolver): void
4242
{
4343
$resolver->setDefaults([
4444
'data_class' => NotificationSelectionData::class,
45+
'submit_name' => 'submit',
4546
]);
4647
}
4748
}

0 commit comments

Comments
 (0)