定制 blanchonvincent/super-messenger 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

blanchonvincent/super-messenger

Composer 安装命令:

composer require blanchonvincent/super-messenger

包简介

ZF2 module v1.0.1 - Boost your FlashMessenger !

README 文档

README

Version 1.0.1 Created by Vincent Blanchon

/!\ This module is now a PR to Zend Framework 2 : https://github.com/zendframework/zf2/pull/3502. Give me your feedback !

Introduction

ZF2 SuperMessenger module provide new features for plugin FlashMessenger. Now, you can add directly 3 level of messages : success message, error message or info message.

Usage

• Usage in controller :

$this->flashMessenger()->addInfoMessage('bar-info');
$this->flashMessenger()->addSuccessMessage('bar-success');
$this->flashMessenger()->addErrorMessage('bar-error');

Just active the module and the FlashMessenger will have features without BC ! You can use SuperMessenger by the identifier "FlashMessenger" with the alias. You could use the identifier "SuperMessenger" to pilot the plugin.

• Usage in view :

And to be complete, there is a view helper. Usage in a view to get list of messages :

<?php
    $infoMessages = $this->flashMessenger('info');
?>

You can directly have a render of the messages :

<?php
    echo $this->flashMessenger()->render('info');
?>

By default, the format is :

<ul class="info">
    <li>first message</li>
    <li>second message</li>
</ul>

You can change the format, like this :

<?php
    echo $this->flashMessenger()
                ->setMessageOpenFormat('<div%s><p>')
                ->setMessageSeparatorString('</p><p>')
                ->setMessageCloseString('</p></div>')
                ->render('info');
?>

Format could be changed in supermessenger.local.php which will be moved in "/config/autoload" :

'view_helper' => array(
    'supermessenger' => array(
        'message_open_format' => '<div%s><ul><li>',
        'message_separator_string' => '</li><li>',
        'message_close_string' => '</li></ul></div>',
    ),
),

You can change easily the class CSS with :

<?php
    echo $this->flashMessenger()->render('info', array('foo-baz', 'foo-bar'));
?>
<ul class="foo-baz foo-bar">
    <li>first message</li>
    <li>second message</li>
</ul>

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-12-07