occ2 / flashes
Nette 应用程序闪存消息的额外贡献,具有 Bootstrap4 警报样式
v1.1.0
2018-09-05 19:40 UTC
Requires
- php: >=7.0.0
- nette/application: ^2.4
This package is not auto-updated.
Last update: 2024-09-27 07:07:50 UTC
README
此包是 nette/application 闪存消息的额外贡献。它使用 Twitter Bootstrap4 样式(警报)。如果您需要使用它,请将 flashes.latte 移动到您的应用程序模板目录(或您的控制模板目录)
安装
composer require occ2/flashes
用法
在展示者中
<?php
namespace MyApp\Presenters;
use Nette\Application\UI\Presenter
class MyPresenter extends Presenter{
use TFlashMessage;
public function handleSomething(){
... // some code
$this->flashMessage("Error message","danger", "some comment of message", "fa fas-cross", 75, "xl", 10);
if($this->isAjax(){
$this->redrawControl();
}
else{
$this->redirect("this");
}
}
}
flashMessage() 函数的参数
- $message - 警报标题
- $type - 警报类型(成功、主要、信息、警告、危险)
- $comment - 消息注释
- $icon - 图标类(例如来自 Font Awesome)
- $width - 警报宽度(相对 - 可能是 25、50、75、100)
- $size - 图标大小前缀(可能是 xs、sm、lg、xl)
- $delay - 自动隐藏闪存消息的秒数