如何解决自定义管理员通知在 Magento 2.3.5 中不起作用
我想创建自定义管理员通知,但它不起作用,我不知道我做错了什么。
我在 di.xml
中添加了此代码<type name="Magento\Framework\Notification\MessageList">
<arguments>
<argument name="messages" xsi:type="array">
<item name="WarrantyMessageNotification" xsi:type="string">Mrt\Warranty\Model\Warranty\Message\Notification</item>
</argument>
</arguments>
</type>
并在Mrt\Warranty\Model\Warranty\Message
下创建Notification.phpnamespace Mrt\Warranty\Model\Warranty\Message;
class Notification implements \Magento\Framework\Notification\MessageInterface
{
/**
* Message identity
*/
const MESSAGE_IDENTITY = 'mrt_message_identity';
public function getIdentity()
{
return self::MESSAGE_IDENTITY;
}
public function isDisplayed()
{
// Return true to show your message,false to hide it
return true;
}
public function getText()
{
return "Notification Add Successfully";
}
public function getSeverity()
{
return self::SEVERITY_NOTICE;
}
}
实施后,我运行了所有这些命令:
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
谁能告诉我我是否遗漏了什么?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。