danielhurdmint/silverstripe-flashmessage 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

danielhurdmint/silverstripe-flashmessage

Composer 安装命令:

composer require danielhurdmint/silverstripe-flashmessage

包简介

Easy flash messages for Silverstripe

README 文档

README

Scrutinizer Packagist Packagist

Display simple one-time flash message with Twitter Bootstrap or Zurb Foundation markup.

    public function submitForm($data, Form $form)
    {
        $form->saveInto($this->record);
        $this->record->write();
    
        Flash::success('Form saved');
    
        return $this->controller->redirect($this->controller->Link());
    }

Installation

$ composer require axyr/silverstripe-flashmessage

Add the template variable $FlashMessage to your Page template where you wish the flash dialog to appear.

Usage

The FlashMessage template has all the markup and attributes so that it will play nicely with the Twitter Bootstrap and Zurb Foundation frameworks.

http://getbootstrap.com/components/#alerts

http://foundation.zurb.com/sites/docs/callout.html

You can set a colored flash message with te following methods:

Flash::info('Some message');
Flash::success('Some message');
Flash::warning('Some message');
Flash::danger('Some message'); // Bootstrap
Flash::alert('Some message'); // Foundation

By default the message will be closable, but this can be disabled. You can also set the message to automaticly fadeout.

For this to work, we assume jQuery is used and the flashmessage.js file is added to the Requirements::javascript();

Flash::success('You cannot close me', false);
Flash::success('I will fade out', false, true);

You can also show the message in a modal window :

Flash::modal('Some message');

Config

FlashMessage:
   defaults:
     Type: success
     Closable: true
     FadeOut: false
   supported_methods:
     - info
     - success
     - warning
     - danger
     - alert
     - modal
   template: FlashMessage
   session_name: FlashMessage
   load_javascript: true

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2024-04-17