You are here

protected function PromotionReport::doBuildReportTableRow in Commerce Reporting 8

Build the report table row.

Parameters

array $result: The result row.

Return value

array The table row data.

Overrides ReportTypeBase::doBuildReportTableRow

File

src/Plugin/Commerce/ReportType/PromotionReport.php, line 159

Class

PromotionReport
Provide a report for Promotions on behalf of commerce_promotion.

Namespace

Drupal\commerce_reports\Plugin\Commerce\ReportType

Code

protected function doBuildReportTableRow(array $result) {
  $currency_code = $result['promotion_amount_currency_code'];
  $row = [
    $result['formatted_date'],
    $result['promotion_id_count'],
    [
      'data' => [
        '#type' => 'inline_template',
        '#template' => '{{price|commerce_price_format}}',
        '#context' => [
          'price' => new Price($result['promotion_amount_sum'], $currency_code),
        ],
      ],
    ],
    $result['coupon_id_count'],
    [
      'data' => [
        '#type' => 'inline_template',
        '#template' => '{{price|commerce_price_format}}',
        '#context' => [
          'price' => new Price($result['coupon_amount_sum'], $currency_code),
        ],
      ],
    ],
    $currency_code,
  ];
  return $row;
}