PHP Class UxWeb\SweetAlert\SweetAlertNotifier

Show file Open project: uxweb/sweet-alert Class Usage Examples

Protected Properties

Property Type Description
$config array Configuration options.
$session UxWeb\SweetAlert\SessionStore

Public Methods

Method Description
__construct ( UxWeb\SweetAlert\SessionStore $session ) Create a new SweetAlertNotifier instance.
autoclose ( integer $milliseconds = null ) : SweetAlertNotifier Set the duration for this alert until it autocloses.
basic ( string $text, string $title ) : SweetAlertNotifier Display a not typed alert message with a text and a title.
cancelButton ( $buttonText = 'Cancel' )
confirmButton ( string $buttonText = 'OK' ) : SweetAlertNotifier Add a confirmation button to the alert.
error ( string $text, string $title = '' ) : SweetAlertNotifier Display an error typed alert message with a text and an optional title.
getConfig ( ) : array Return the current alert configuration.
getJsonConfig ( ) : string Return the current alert configuration as Json.
html ( ) : SweetAlertNotifier Make Message HTML view.
info ( string $text, string $title = '' ) : SweetAlertNotifier Display an info typed alert message with a text and an optional title.
message ( string $text, string $title = '', string $type = null ) : SweetAlertNotifier Display an alert message with a text and an optional title.
persistent ( string $buttonText = 'OK' ) : SweetAlertNotifier Make this alert persistent with a confirmation button.
success ( string $text, string $title = '' ) : SweetAlertNotifier Display a success typed alert message with a text and an optional title.
warning ( string $text, string $title = '' ) : SweetAlertNotifier Display a warning typed alert message with a text and an optional title.

Protected Methods

Method Description
buildJsonConfig ( ) : string Build the configuration as Json.
flashConfig ( ) : void Flash the current alert configuration to the session store.
hasTitle ( ) : boolean Determine if the title is set.
removeTimer ( ) : void Remove the timer config option.
setDefaultConfig ( ) : void Sets all default config options for an alert.
switchTitle ( $config ) : void Switch the text message to the title key.

Method Details

__construct() public method

Create a new SweetAlertNotifier instance.
public __construct ( UxWeb\SweetAlert\SessionStore $session )
$session UxWeb\SweetAlert\SessionStore

autoclose() public method

Set the duration for this alert until it autocloses.
public autoclose ( integer $milliseconds = null ) : SweetAlertNotifier
$milliseconds integer
return SweetAlertNotifier $this

basic() public method

Display a not typed alert message with a text and a title.
public basic ( string $text, string $title ) : SweetAlertNotifier
$text string
$title string
return SweetAlertNotifier $this

buildJsonConfig() protected method

Build the configuration as Json.
protected buildJsonConfig ( ) : string
return string

cancelButton() public method

public cancelButton ( $buttonText = 'Cancel' )

confirmButton() public method

Add a confirmation button to the alert.
public confirmButton ( string $buttonText = 'OK' ) : SweetAlertNotifier
$buttonText string
return SweetAlertNotifier $this

error() public method

Display an error typed alert message with a text and an optional title.
public error ( string $text, string $title = '' ) : SweetAlertNotifier
$text string
$title string
return SweetAlertNotifier $this

flashConfig() protected method

Flash the current alert configuration to the session store.
protected flashConfig ( ) : void
return void

getConfig() public method

Return the current alert configuration.
public getConfig ( ) : array
return array

getJsonConfig() public method

Return the current alert configuration as Json.
public getJsonConfig ( ) : string
return string

hasTitle() protected method

Determine if the title is set.
protected hasTitle ( ) : boolean
return boolean

html() public method

Make Message HTML view.
public html ( ) : SweetAlertNotifier
return SweetAlertNotifier $this

info() public method

Display an info typed alert message with a text and an optional title.
public info ( string $text, string $title = '' ) : SweetAlertNotifier
$text string
$title string
return SweetAlertNotifier $this

message() public method

By default the alert is not typed.
public message ( string $text, string $title = '', string $type = null ) : SweetAlertNotifier
$text string
$title string
$type string
return SweetAlertNotifier $this

persistent() public method

Make this alert persistent with a confirmation button.
public persistent ( string $buttonText = 'OK' ) : SweetAlertNotifier
$buttonText string
return SweetAlertNotifier $this

removeTimer() protected method

Remove the timer config option.
protected removeTimer ( ) : void
return void

setDefaultConfig() protected method

Sets all default config options for an alert.
protected setDefaultConfig ( ) : void
return void

success() public method

Display a success typed alert message with a text and an optional title.
public success ( string $text, string $title = '' ) : SweetAlertNotifier
$text string
$title string
return SweetAlertNotifier $this

switchTitle() protected method

Switch the text message to the title key.
protected switchTitle ( $config ) : void
return void

warning() public method

Display a warning typed alert message with a text and an optional title.
public warning ( string $text, string $title = '' ) : SweetAlertNotifier
$text string
$title string
return SweetAlertNotifier $this

Property Details

$config protected property

Configuration options.
protected array $config
return array

$session protected property

protected SessionStore,UxWeb\SweetAlert $session
return UxWeb\SweetAlert\SessionStore