You are here

public function CommerceGCTransactionViewsController::views_data in Commerce GC 7

Override EntityDefaultViewsController::views_data().

Overrides EntityDefaultViewsController::views_data

File

includes/views/commerce_gc.views.inc, line 60
Provides support for the Views module.

Class

CommerceGCTransactionViewsController
Commerce discount entity Views definitions.

Code

public function views_data() {
  $data = parent::views_data();
  $data['commerce_gc_transaction']['table']['base']['access query tag'] = 'commerce_gc_transaction_access';

  // Make amount a currency field
  $data['commerce_gc_transaction']['amount']['field'] = array(
    'handler' => 'commerce_gc_handler_field_amount',
  );
  $data['commerce_gc_transaction']['date'] = array(
    'title' => t('Date'),
    'help' => t('The date the transaction occurred.'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );

  // Coupon relationship
  $data['commerce_gc_transaction']['coupon_id']['relationship'] = array(
    'handler' => 'views_handler_relationship',
    'base' => 'commerce_coupon',
    'field' => 'coupon_id',
    'label' => t('Coupon'),
  );

  // Giftcard balance summary field
  $data['commerce_gc_transaction']['delete'] = array(
    'field' => array(
      'title' => t('Delete transaction link'),
      'help' => t('Provides a link to delete a transaction.'),
      'handler' => 'commerce_gc_handler_field_transaction_delete',
    ),
  );
  return $data;
}