-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathcommerce_log.module
More file actions
34 lines (30 loc) · 956 Bytes
/
commerce_log.module
File metadata and controls
34 lines (30 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @file
* Provides activity logs for Commerce entities.
*/
use Drupal\commerce_log\PaymentListBuilder;
/**
* Implements hook_preprocess_commerce_order().
*/
function commerce_log_preprocess_commerce_order(&$variables) {
/** @var \Drupal\commerce_order\Entity\OrderInterface $order */
$order = $variables['elements']['#commerce_order'];
$variables['order']['activity'] = [
'#type' => 'view',
'#name' => 'commerce_activity',
'#display_id' => 'default',
'#arguments' => [$order->id(), 'commerce_order'],
'#embed' => TRUE,
'#title' => t('Order activity'),
];
}
/**
* Implements hook_entity_type_alter() for commerce_payment.
*/
function commerce_log_entity_type_alter(array &$entity_types) {
if (isset($entity_types['commerce_payment'])) {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
$entity_types['commerce_payment']->setListBuilderClass(PaymentListBuilder::class);
}
}