markshust/magento2-module-messages
Composer 安装命令:
composer require markshust/magento2-module-messages
包简介
The Messages module allows you to send success, notice, warning and error messages with HTML.
README 文档
README
Send success, notice, warning and error messages with <html>
Table of contents
Summary
By default, when you call $this->messageManager->addSuccessMessage within Magento, you cannot pass custom HTML into your message. This doesn't provide you with the flexibility to provide customized messages to your visitors.
This module provides the ability to display custom messages including HTML, and still escapes the HTML to prevent cross-site scripting (XSS) attacks.
Installation
composer require markshust/magento2-module-messages
bin/magento module:enable MarkShust_Messages
bin/magento setup:upgrade
API
/** * Any of the built-in complex message functions can be called with this identifer: * addComplexSuccessMessage * addComplexNoticeMessage * addComplexWarningMessage * addComplexErrorMessage * * @param string $identifer Set to 'withHtml' to use this module. * @param mixed[] $data Data containing elements. * @type string 'html' Desired output including HTML. * @type string[] 'allowed_tags' (optional) List of allowed tags to render as HTML. */ $this->messageManager->addComplexSuccessMessage($identifer, $data);
Usage
protected messageManager; public function __construct( ... \Magento\Framework\Message\ManagerInterface $messageManager, ... ) { $this->messageManager = $messageManager; ... } $this->messageManager->addComplexSuccessMessage('withHtml', [ 'html' => '<b>This is bold text!</b> And this is not.', 'allowed_tags' => ['b'], ]);
License
markshust/magento2-module-messages 适用场景与选型建议
markshust/magento2-module-messages 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 57, 最近一次更新时间为 2019 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 markshust/magento2-module-messages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 markshust/magento2-module-messages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 57
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-30
