You are here

function hook_audit_log_alter in Audit Log 7

Alter an audit log before it is saved.

Parameters

Auditlog $log: The audit log that will be saved.

array $context: An array with the following keys:

  • entity: The entity on which the action is performed.
  • entity_type: The entity type of the entity on which the action is

performed.

  • action: The action that was performed ('view', 'insert', 'update' or

'delete).

  • account: The user that performed the action.
  • url: The url on which the action was performed.
  • timestamp: The timestamp when the action was performed.
1 invocation of hook_audit_log_alter()
audit_log in ./audit_log.module
Log an audit log.

File

./audit_log.api.php, line 62
API documentation for the Audit log module.

Code

function hook_audit_log_alter(Auditlog &$log, array $context) {
  if ($context['entity_type'] == 'node' && $context['entity']->type == 'my_type') {
    $node = entity_metadata_wrapper($context['entity_type'], $context['entity']);
    $log->custom_value = $node->field_custom_value
      ->value();
  }
}