mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Add "groupCreate" event
This commit is contained in:
parent
9b05509ec4
commit
1aec37b6f6
@ -32,6 +32,15 @@ final class Events
|
||||
*/
|
||||
const CRON_RUN = 'cronRun';
|
||||
|
||||
/**
|
||||
* A group is created.
|
||||
*
|
||||
* This event is triggered after a group has been created. An associative
|
||||
* array with the following items is passed to the event handlers:
|
||||
* - "group": group's array.
|
||||
*/
|
||||
const GROUP_CREATE = 'groupCreate';
|
||||
|
||||
/**
|
||||
* An operator cannot be authenticated.
|
||||
*
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
|
||||
// Import namespaces and classes of the core
|
||||
use Mibew\EventDispatcher\EventDispatcher;
|
||||
use Mibew\EventDispatcher\Events;
|
||||
use Mibew\Database;
|
||||
use Mibew\Settings;
|
||||
|
||||
@ -291,6 +293,8 @@ function check_group_params($group, $extra_params = null)
|
||||
/**
|
||||
* Creates group
|
||||
*
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::GROUP_CREATE} event.
|
||||
*
|
||||
* @param array $group Operators' group. The $group array must contains the
|
||||
* following keys:
|
||||
* - name,
|
||||
@ -339,6 +343,9 @@ function create_group($group)
|
||||
array('return_rows' => Database::RETURN_ONE_ROW)
|
||||
);
|
||||
|
||||
$args = array('group' => $new_group);
|
||||
EventDispatcher::getInstance()->triggerEvent(Events::GROUP_CREATE, $args);
|
||||
|
||||
return $new_group;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user