3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
12 namespace Civi\Core\Event
;
15 * Class AuthorizeEvent
16 * @package Civi\API\Event
18 class PreEvent
extends GenericHookEvent
{
21 * This adapter automatically emits a narrower event.
23 * For example, `hook_civicrm_pre(Contact, ...)` will also dispatch `hook_civicrm_pre::Contact`.
25 * @param \Civi\Core\Event\PreEvent $event
27 public static function dispatchSubevent(PreEvent
$event) {
28 \Civi
::service('dispatcher')->dispatch("hook_civicrm_pre::" . $event->entity
, $event);
32 * One of: 'create'|'edit'|'delete'
56 * @param string $action
57 * @param string $entity
59 * @param array $params
61 public function __construct($action, $entity, $id, &$params) {
62 $this->action
= $action;
63 $this->entity
= $entity;
65 $this->params
= &$params;
71 public function getHookValues() {
72 return [$this->action
, $this->entity
, $this->id
, &$this->params
];