/** * Get a bootstrap alert * @param string $text - The content of alert * @param type $style - one of the bootstrap styles e.g. success * @param array $options - Html options * @param bool $isDismissible - True to add close button * @return <div class="alert alert-$style">$text</div> */ public function getAlert($text, $style = 'success', $options = [], $isDismissible = false) { $class = GeneralFunctions::getAlertClass($style); $options['class'] = GeneralFunctions::combineValues($options, 'class', $class); $options['role'] = 'alert'; $content = ''; if ($isDismissible) { $extraContent = ' <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; $options['class'] = GeneralFunctions::combineValues($options, 'class', BootstrapClasses::ALERT_DISMISSIBLE); $content = GeneralFunctions::appendValue($extraContent, $text); } else { $content = $text; } return $this->Html->tag('div', $content, $options); }