To enable Notification API, proceed to Miscellaneous screen, click 'Notification API' button, enable this feature and create a new table to store notifications. Now, since this is an API, we need to write some code to make it work. Let's start with something simple.
When someone adds a new record to the Categories table we also want to create a notification.For this purpose, we will add the following code to the Categories table AfterAdd event:
addNotification( "New category added: ".$values["CategoryName"] , "New category", "fa-envelope", makePageLink( "categories", "view", $keys) );
If everything worked as expected, we will see a new notification added after each new record in the Categories table. And if we click on any notification, it will take us to that new category view page.
Methods
Method |
Description |
Add a new notification |
|
Alternative syntax |