* @since 2.0 */ class Alert { /** * Generates an alert box * @param $message * @param array $htmlOptions * @param bool $dismiss whether to display dismissal link or not * @return string */ public static function create($message, $htmlOptions = array(), $dismiss = true) { // TODO: this method may should be added to ArrayHelper::add or ArrayHelper::append? if (isset($htmlOptions['class'])) $htmlOptions['class'] .= ' ' . AlertEnum::CLASS_NAME; else $htmlOptions['class'] = AlertEnum::CLASS_NAME; ob_start(); echo Html::beginTag('div', $htmlOptions); if ($dismiss) echo Button::closeLink('×', BootstrapEnum::ALERT); echo $message; echo Html::endTag('div'); return ob_get_clean(); } }