[CONTROLLR][UserPanel][PLUGINS] Add submit button to notification settings for each transport
This commit is contained in:
parent
afbcb179b2
commit
cdf3426567
@ -39,7 +39,8 @@ class EmailNotifications extends Plugin
|
|||||||
{
|
{
|
||||||
public function onAddNotificationTransport(&$form_defs): bool
|
public function onAddNotificationTransport(&$form_defs): bool
|
||||||
{
|
{
|
||||||
$form_defs['email'] = $form_defs['placeholder'];
|
$form_defs['email'] = $form_defs['placeholder'];
|
||||||
|
$form_defs['email'][] = $form_defs['placeholder']['save']('Email', 'save_email');
|
||||||
unset($form_defs['email']['post_on_status_change']);
|
unset($form_defs['email']['post_on_status_change']);
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ class XMPPNotifications extends Plugin
|
|||||||
{
|
{
|
||||||
public function onAddNotificationTransport(&$form_defs): bool
|
public function onAddNotificationTransport(&$form_defs): bool
|
||||||
{
|
{
|
||||||
$form_defs['xmpp'] = $form_defs['placeholder'];
|
$form_defs['xmpp'] = $form_defs['placeholder'];
|
||||||
|
$form_defs['xmpp'][] = $form_defs['placeholder']['save']('XMMP', 'save_xmpp');
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,12 +177,24 @@ class UserPanel extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form_defs['placeholder']['save'] = fn(string $transport, string $form_name) =>
|
||||||
|
[$form_name, SubmitType::class,
|
||||||
|
['label' => _m('Save notification settings for {transport}', ['transport' => $transport])]];
|
||||||
|
|
||||||
Event::handle('AddNotificationTransport', [&$form_defs]);
|
Event::handle('AddNotificationTransport', [&$form_defs]);
|
||||||
unset($form_defs['placeholder']);
|
unset($form_defs['placeholder']);
|
||||||
|
|
||||||
$tabbed_forms = [];
|
$tabbed_forms = [];
|
||||||
foreach ($form_defs as $transport_name => $f) {
|
foreach ($form_defs as $transport_name => $f) {
|
||||||
$tabbed_forms[$transport_name] = Form::create($f);
|
unset($f['save']);
|
||||||
|
$form = Form::create($f);
|
||||||
|
$tabbed_forms[$transport_name] = $form;
|
||||||
|
|
||||||
|
$form->handleRequest($request);
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$data = $form->getData();
|
||||||
|
dd($data, $transport_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabbed_forms = F\map($tabbed_forms, function ($f) {
|
$tabbed_forms = F\map($tabbed_forms, function ($f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user