PHP Class WPDKUIAlert

### Create an Alert To create and display an alert just coding: $alert = new WPDKUIAlert( 'my-alert', 'Hello World!' ); $alert->display(); OR class myAlert extends WPDKUIAlert { Internal construct public function __construct() { parent::__construct( $id, false, $type, $title ); } Override content public function content() { echo 'Hello...'; } }
Since: 1.4.21
Author: =undo= ([email protected])
Inheritance: extends WPDKHTMLTag
ファイルを表示 Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$block boolean Set TRUE for alert-block class style
$content string The HTML content of alert.
$dismissButton boolean Set TRUE to display dismiss [x] button. Default TRUE.
$dismissButtonGlyph string Used to get/set the glyph icon used like dismiss button.
$dismissPermanent boolean If TRUE this alert is permanent dismiss by a logged in user
$dismissToolTip string This is the tooltip (for more detail) display on dismiss button.
$dismiss_button_glyph string Glyph used like dismiss button
$dismissable boolean Add alert-dismissable class in HTML markup.
$permanent_dismiss boolean If TRUE this alert is permanet dismiss by a logged in user
$title string Title of the alter.
$type string The alert type change the left border color. Use the constants in WPDKUIAlertType class.
$wpautop boolean If TRUE the WordPress wpautop() on content.

Protected Properties

Property Type Description
$dismissed array Internal use only.

Public Methods

Method Description
__construct ( string $id = false, string $content = '', string $type = WPDKUIAlertType::INFORMATION, string $title = '' ) : WPDKUIAlert Create an instance of WPDKUIAlert class.
alert ( $echo = true )
content ( ) : string Content
html ( ) : string Return the HTML markup for alert
title ( ) : string Title
toControl ( ) : array Return an array item description in Control Layout Array format

Private Methods

Method Description
_content ( ) : string Return a formatted content
_dismissButton ( ) : string Return the HTML markup button for dismiss
_title ( ) : string Return the title
alert_block ( ) : string Return alert-block class style

Method Details

__construct() public method

Create an instance of WPDKUIAlert class.
public __construct ( string $id = false, string $content = '', string $type = WPDKUIAlertType::INFORMATION, string $title = '' ) : WPDKUIAlert
$id string Optional. This alert id. If FALSE a unique id is create in order to avoid potential alert display missing.
$content string Optional. An HTML content for this alert
$type string Optional. See WPDKUIAlertType. Default WPDKUIAlertType::INFORMATION
$title string Optional. Title of alert
return WPDKUIAlert

alert() public method

Deprecation: Use display() or html() instead
public alert ( $echo = true )

content() public method

Content
public content ( ) : string
return string

html() public method

Return the HTML markup for alert
public html ( ) : string
return string

title() public method

Title
public title ( ) : string
return string

toControl() public method

Return an array item description in Control Layout Array format
Since: 1.0.0
public toControl ( ) : array
return array

Property Details

$block public_oe property

Set TRUE for alert-block class style
Deprecation: Since WPDK 1.3.1 and Bootstrap 3.0.0
public bool $block
return boolean

$content public_oe property

The HTML content of alert.
public string $content
return string

$dismissButton public_oe property

Set TRUE to display dismiss [x] button. Default TRUE.
public bool $dismissButton
return boolean

$dismissButtonGlyph public_oe property

Used to get/set the glyph icon used like dismiss button.
Since: 1.5.6
public string $dismissButtonGlyph
return string

$dismissPermanent public_oe property

If TRUE this alert is permanent dismiss by a logged in user
Since: 1.5.6
public bool $dismissPermanent
return boolean

$dismissToolTip public_oe property

This is the tooltip (for more detail) display on dismiss button.
Since: 1.4.8
public string $dismissToolTip
return string

$dismiss_button_glyph public_oe property

Glyph used like dismiss button
Deprecation: since 1.5.6 Use $dismissButtonGlyph instead
public string $dismiss_button_glyph
return string

$dismissable public_oe property

Add alert-dismissable class in HTML markup.
Since: 1.3.1
public bool $dismissable
return boolean

$dismissed protected_oe property

Internal use only.
protected array $dismissed
return array

$permanent_dismiss public_oe property

If TRUE this alert is permanet dismiss by a logged in user
Deprecation: 1.5.6 Use $dismissPermanent
Since: 1.4.21
public bool $permanent_dismiss
return boolean

$title public_oe property

Title of the alter.
public string $title
return string

$type public_oe property

The alert type change the left border color. Use the constants in WPDKUIAlertType class.
public string $type
return string

$wpautop public_oe property

If TRUE the WordPress wpautop() on content.
Since: 1.6.1
public bool $wpautop
return boolean