You are here

protected function PromotionViewsData::processViewsDataForDatetime in Commerce Core 8.2

Corrects the views data for datetime base fields.

Based on datetime_field_views_data().

Parameters

string $table: The table name.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

array $views_field: The views field data.

string $field_column_name: The field column being processed.

Overrides CommerceEntityViewsData::processViewsDataForDatetime

File

modules/promotion/src/PromotionViewsData.php, line 16

Class

PromotionViewsData
Provides views data for promotions.

Namespace

Drupal\commerce_promotion

Code

protected function processViewsDataForDatetime($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) {
  parent::processViewsDataForDatetime($table, $field_definition, $views_field, $field_column_name);

  // Promotion date/time fields are always used in the store timezone.
  if ($field_column_name == 'value') {
    $views_field['field']['default_formatter'] = 'commerce_store_datetime';
    $views_field['filter']['id'] = 'commerce_store_datetime';
  }
}