3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00
farmOS/modules/core/log/farm_log.module

34 lines
870 B
PHP
Raw Normal View History

<?php
/**
* @file
* Contains farm_log.module.
*/
use Drupal\farm_log\Event\LogEvent;
use Drupal\log\Entity\LogInterface;
/**
* Implements hook_ENTITY_TYPE_presave().
*/
function farm_log_log_presave(LogInterface $log) {
// Dispatch an event on log presave.
// @todo Replace this with core event via https://www.drupal.org/node/2551893.
$event = new LogEvent($log);
$event_dispatcher = \Drupal::service('event_dispatcher');
$event_dispatcher->dispatch(LogEvent::PRESAVE, $event);
}
2021-01-06 16:55:46 +01:00
/**
* Implements hook_ENTITY_TYPE_delete().
*/
function farm_log_log_delete(LogInterface $log) {
// Dispatch an event on log delete.
// @todo Replace this with core event via https://www.drupal.org/node/2551893.
$event = new LogEvent($log);
$event_dispatcher = \Drupal::service('event_dispatcher');
$event_dispatcher->dispatch(LogEvent::DELETE, $event);
}