Download the PHP package montikids/module-message-popup without Composer
On this page you can find all versions of the php package montikids/module-message-popup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download montikids/module-message-popup
More information about montikids/module-message-popup
Files in montikids/module-message-popup
Package module-message-popup
Short Description Magento 2 popup messages module
License MIT
Homepage https://github.com/montikids/module-message-popup
Informations about the package module-message-popup
About the module
The module allows us to use popups to display notification messages. It works for both: frontend and admin areas.
It also is quite flexible. For instance, you can use it only for displaying error messages for admins and keep all the other notifications displaying in the standard way. Furthermore, you don't have to replace standard notifications at all, just use it for custom-defined messages in places you need it.
Main features
- Adding a custom popup notification is the frontend area with a single line of code, the same way you do it for the standard Magento notifications
- Adding a custom popup notification is the admin area with a single line of code, the same way you do it for the standard Magento notifications
- Displaying popup notifications on success/error AJAX responses in the admin area (for custom AJAX grids and forms)
- Allowing using certain HTML tags in the notification text:
div
,span
,b
,strong
,i
,em
,u
,a
,br
OPTIONAL
Replacing all the standard notifications in the frontend area- Success notifications (turn it on/off at any moment)
- Error notifications (turn it on/off at any moment)
- Warning notifications (turn it on/off at any moment)
- Notice notifications (turn it on/off at any moment)
OPTIONAL
Replacing all the standard notifications in the admin area- Success notifications (turn it on/off at any moment)
- Error notifications (turn it on/off at any moment)
- Warning notifications (turn it on/off at any moment)
- Notice notifications (turn it on/off at any moment)
- Popups adapted for mobile devises
How does it look like
Admin area
Success notification
Error notification
Warning notification
Frontend area
Success notification
Notice notification
Warning notification
Error notification
How to use
Add a new popup message in any area
It's a two-step action.
-
Add the message manager to the constructor of your controller
- Add messages of any type as you do this with the standard Magento's message manager. You can do this because the
PopupMessageProxy
class implements the\Magento\Framework\Message\ManagerInterface
interface.
Display currently existed messages in popups
- Go to the admin settings
Stores -> Configuration -> Montikids -> Message Popup
- Make sure you enabled the module itself
- Make sure you allowed popup notifications in the desired area
- Enable the replacement mode for the area
- Select which types of the notifications you want to see in popups
- Save the configuration
- Flush the config cache
Display popup on AJAX response
It's intended to be used with AJAX forms in the admin area, when you display the form in a popup, instead of redirecting to an edit page. You can try to use it with another UI components hat make AJAX calls, but it's not tested yet.
- Go to the admin settings
Stores -> Configuration -> Montikids -> Message Popup
You don't have to specify each option, only the ones you want to override. Potentially, nn case you're okay with the default values, is can be as simple as that:
An example of the possible structure of your AJAX response JSON body:
Local developing
The is only one of several options, but I think it's the simplest one.
The main approach is to clone the repository inside a separate folder and tell composer to use this folder as source of the package.
If you don't like it, feel free using other approaches, like git submodules, Modman, or direct cloning inside the app/code
folder.
Go to the root of your Magento installation and create a new folder inside your Magento project:
Go inside:
Clone the package repository:
Go back to the root of your project:
Tell composer to load the package from the local path:
Install the package as usual:
As a result, you get symlinked your app/packages/montikids/module-message-popup
folder to the vendor/montikids/module-message-popup
.
The main difference between this and just placing the repository into app/code
that you can always make sure your composer.json
is correct and the module is compatible with your project.
If you have already installed the module via composer, remove the folder first: