mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
33 lines
870 B
PHP
33 lines
870 B
PHP
<?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);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|