1

how to make notification popup in admin as a module. enter image description here

Any help? Thank in advance.

0

Create the below files in your custom module.

app/code/Vendor/Notification/etc/adminhtml/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <type name="Magento\Framework\Notification\MessageList">
       <arguments>
           <argument name="messages" xsi:type="array">
               <item name="Notification" xsi:type="string">Vendor\Notification\Model\Notification</item>
           </argument>
       </arguments>
   </type>
</config>

app/code/Vendor/Notification/Model/Notification.php

<?php
namespace Vendor\Notification\Model;
class Notification implements \Magento\Framework\Notification\MessageInterface
{
    public function getIdentity()
    {
        // Unique message identity
        return 'identity';
    }
    public function isDisplayed()
    {
        // Return true to show your message, false to hide it
        return true;
    }
    public function getText()
    {
        // Your Custom Message here.
        return "Notification Add Successfully";
    }
    public function getSeverity()
    {
        //Available Message Types
        // SEVERITY_CRITICAL
        // SEVERITY_MAJOR
        // SEVERITY_MINOR
        // SEVERITY_NOTICE
        return self::SEVERITY_CRITICAL;
    }
}

Hope this will work for you.

| improve this answer | |
  • are you try this, your code makes system message, not popup message. – MichaelHa Jan 3 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.