1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 19:44:09 +02:00

Closes #4922 - Option for plugins to extend notification routing.

This commit is contained in:
Cameron
2022-12-13 18:23:48 -08:00
parent f85de1ba5b
commit 05b1b040c8
5 changed files with 296 additions and 116 deletions

View File

@@ -42,7 +42,48 @@ class _blank_notify extends notify
$this->send('customNotify', $subject, $message);
}
// BELOW IS OPTIONAL - R IF YOU WISH YOUR PLUGIN TO BECOME A ROUTER OF NOTIFICATIONS. eg. sending sms or messages to other platforms.
/**
* REMOVE THIS METHOD WHEN NOT IN USE.
* @return array
*/
function router()
{
$ret = [];
$ret['other_type'] = array( // 'other_type' method will be called when this notification is triggered (see method below)
'label' => "Blank Example", // label used in admin Notify area
'field' => "handle", // rendered in the admin Notify area when this option is selected. see method below.
'category' => ''
);
return $ret;
}
/**
* Custom method used to render a field in Admin Notify area.
* REMOVE THIS METHOD WHEN NOT IN USE.
* @param string $name Field name.
* @param mixed $curVal current value.
* @return string
*/
function handle($name, $curVal)
{
return e107::getForm()->text($name, $curVal, 80, ['size'=>'large','placeholder'=>'eg. account name']);
}
/**
* Custom Method to handle notification.
* REMOVE THIS METHOD WHEN NOT IN USE
* @param array $data
* @return string
*/
function other_type($data)
{
return $data; // Peform some other kind of notification and return true on success / false on error.
}
}