Hi,
maybe another suggestion.
You could also use the build in Notification::show.
On the table after update put the message you want to display into the $_SESSION variable.
On the detailview (I assume after you save the record, you go back to the detail view) check for that information and display the Notification.
Code could look like:
YOURTABLENAME_after_update:
Code: Select all
$sendResult = sendmail([
'to' => $recipeint_mail,
'name' => $recipient,
'subject' => '...',
'message' => "..."
]);
if ($sendResult === true) {
$_SESSION['YOURTABLENAME_msg'.$data['selectedID']]='Notification email sent to '.$recipient;
$_SESSION['YOURTABLENAME_cls'.$data['selectedID']]='success');
} else {
$_SESSION['YOURTABLENAME_msg'.$data['selectedID']]='Unable to send notification email to '.$recipient;
$_SESSION['YOURTABLENAME_cls'.$data['selectedID']]='danger');
}
YOURTABLENAME_header -> detailview :
Code: Select all
case 'detailview':
$header='';
if (isset($_SESSION['YOURTABLENAME_msg'.$_REQUEST['SelectedID']]) && isset($_SESSION['YOURTABLENAME_cls'.$_REQUEST['SelectedID']])) {
$header='<%%HEADER%%>'.Notification::show([
'message' => $_SESSION['YOURTABLENAME_msg'.$_REQUEST['SelectedID']],
'class' => $_SESSION['YOURTABLENAME_cls'.$_REQUEST['SelectedID']],
'dismiss_seconds' => 5]);
unset($_SESSION['YOURTABLENAME_msg'.$_REQUEST['SelectedID']]);
unset($_SESSION['YOURTABLENAME_cls'.$_REQUEST['SelectedID']]);
};
break;
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.