sc_alert("Message", $array)

This macro sends a message in the alert style of Javascript (Sweetalert) or Sweetalert2.

Ps  

To display the message using a sweetalert2 library, the Use SweetAlert option must be enabled in the application where the macro will be used.  

This option can be enabled in the application's configuration menu. To access the click on: Application> Configuration the option is in the Notification Settings block

Check below the parameters supported by the macro:

  • Message: Mandatory parameter that contains the message that will be displayed.
  • $array: This parameter is optional when using the macro, more mandatory when we want to use Sweetalert2.
    When used, it expects to receive an array with Sweetalert2's settings.

Check the list of configurations accepted by Sweetalert2 in this macro:

 

Parameter Value Description
title Example of how it should be informed within the array: 'title' => 'Título' Text that will be displayed in the card title, if the toast option is marked as false. 'toast' => false
type

Example of how it should be informed within the array: 'type' => 'warning'

List of accepted options:

  • success
  • error
  • warning
  • info
Defines the type of message that will be displayed.
timer Example of how it should be informed within the array: 'timer' => '2000' Defines the time in milliseconds that the message will be displayed.
showConfirmButton

Example of how it should be informed within the array: 'showConfirmButton' => false

List of accepted options:

  • True: Exibe o botão de confirmação.
  • false: Não exibe o botão de confirmação.
Defines whether a confirmation button is displayed.
position

Example of how it should be informed within the array: 'position' => 'bottom-end',

List of accepted options:

  • top
  • top-start
  • top-end
  • center
  • center-start
  • center-end
  • bottom
  • bottom-start
  • bottom-end
Defines the position where the pop-up will be displayed.
toast Example of how it should be informed within the array: 'toast' => true Defines whether or not we will use toast to display messages. When enabled, this option does not display the confirmation button.

Check below the examples of use of the macro:

E.g.: Message using Sweetalert
sc_alert("This is an alert message!!");

 

E.g.: Message using Sweetalert2

$params = array(
'title' => 'Title',
'type' => 'success',
'timer' => '2000',
'showConfirmButton' => false,
'position' => 'bottom-end',
'toast' => true
);

sc_alert("Inserted successfully!", $params);