src/View/Helper/HtmlHelper.php
public function alert($text, $type = null, $options = []) {
        if (is_string($type)) {
            $options['type'] = $type;
        }
        else if (is_array($type)) {
            $options = $type;
        }
        $options += $this->getConfig('alert') + [
            'templateVars' => []
        ];
        $close = null;
        if ($options['close']) {
            $closeContent = $this->formatTemplate('alertCloseContent', [
                'templateVars' => $options['templateVars']
            ]);
            $close = $this->formatTemplate('alertCloseButton', [
                'label' => __('Close'),
                'content' => $closeContent,
                'attrs' => $this->templater()->formatAttributes([]),
                'templateVars' => $options['templateVars']
            ]);
            $options = $this->addClass($options, 'alert-dismissible');
        }
        return $this->formatTemplate('alert', [
            'type' => $options['type'],
            'close' => $close,
            'content' => $text,
            'attrs' => $this->templater()->formatAttributes($options, ['close', 'type']),
            'templateVars' => $options['templateVars']
        ]);
    }
public function alert($text, $type = null, $options = []) {
        if (is_string($type)) {
            $options['type'] = $type;
        }
        else if (is_array($type)) {
            $options = $type;
        }
        $options += $this->getConfig('alert') + [
            'templateVars' => []
        ];
        $close = null;
        if ($options['close']) {
            $closeContent = $this->formatTemplate('alertCloseContent', [
                'templateVars' => $options['templateVars']
            ]);
            $close = $this->formatTemplate('alertCloseButton', [
                'label' => __('Close'),
                'content' => $closeContent,
                'attrs' => $this->templater()->formatAttributes([]),
                'templateVars' => $options['templateVars']
            ]);
            $options = $this->addClass($options, 'alert-dismissible');
        }
        return $this->formatTemplate('alert', [
            'type' => $options['type'],
            'close' => $close,
            'content' => $text,
            'attrs' => $this->templater()->formatAttributes($options, ['close', 'type']),
            'templateVars' => $options['templateVars']
        ]);
    }
public function alert ( $ text , $ type = null , $ options = [ ] ) { if ( is_string ( $ type ) ) { $ options [ 'type' ] = $ type ; } else if ( is_array ( $ type ) ) { $ options = $ type ; } $ options += $ this -> getConfig ( 'alert' ) + [ 'templateVars' => [ ] ] ; $ close = null ; if ( $ options [ 'close' ] ) { $ closeContent = $ this -> formatTemplate ( 'alertCloseContent' , [ 'templateVars' => $ options [ 'templateVars' ] ] ) ; $ close = $ this -> formatTemplate ( 'alertCloseButton' , [ 'label' => __ ( 'Close' ) , 'content' => $ closeContent , 'attrs' => $ this -> templater ( ) -> formatAttributes ( [ ] ) , 'templateVars' => $ options [ 'templateVars' ] ] ) ; $ options = $ this -> addClass ( $ options , 'alert-dismissible' ) ; } return $ this -> formatTemplate ( 'alert' , [ 'type' => $ options [ 'type' ] , 'close' => $ close , 'content' => $ text , 'attrs' => $ this -> templater ( ) -> formatAttributes ( $ options , [ 'close' , 'type' ] ) , 'templateVars' => $ options [ 'templateVars' ] ] ) ; }
Create a Twitter Bootstrap style alert block, containing text.

The second parameter may either be `$type` or `$options` (in this case,
the third parameter is not used, and the alert type can be specified in the
`$options` array).

### Options

- `close` Dismissible alert. See configuration for default.
- `type` The type of the alert. See configuration for default.
- `templateVars` Provide template variables for the `alert` template.
- Other attributes will be assigned to the wrapper element.

@param string $text The alert text.
@param string|array $type The type of the alert.
@param array $options Array of options. See above.

@return string A HTML bootstrap alert element.
Create a Twitter Bootstrap style alert block containing text .