I want to create a custom admin notification message for a module im developing like the one on the image below. I want the notification to remain visible in all admin pages until a certain condition has been met.
There is another thread on this subject but i couldn't find how to get the model class that implements \Magento\Framework\Notification\MessageInterface to be executed. The thread author mentioned that a dependency to Magento_AdminNotification is needed.
Is that achieved on the di.xml file? A more detailed explanation would be very helpful.
Best Answer
I figured out how to do it. I was writing the di.xml file on the wrong directory.
To get your module's custom notification class to run, you need to create the file
VendorName/ModuleName/etc/adminhtml/di.xml
with the following code:Then you have to create the
VendorName\ModuleName\Model\System\Message\YourClassName.php
class file with the following code: