You are here

protected function CivicrmEntityViewsData::processViewsDataForDatetime in CiviCRM Entity 8.3

Provides Views integration for any datetime-based fields.

This does not provide arguments, as that required an alter against the entire Views data array, which is not possible here.

Parameters

string $table: The table the language field is added to.

\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.

See also

datetime_type_field_views_data_helper()

File

src/CivicrmEntityViewsData.php, line 184

Class

CivicrmEntityViewsData

Namespace

Drupal\civicrm_entity

Code

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

  // Set the 'datetime' filter type.
  $views_field['filter']['id'] = 'datetime';
  $views_field['filter']['field_name'] = $field_definition
    ->getName();

  // Set the 'datetime' argument type.
  $views_field['argument']['id'] = 'datetime';
  $views_field['argument']['field_name'] = $field_definition
    ->getName();

  // Set the 'datetime' sort handler.
  $views_field['sort']['id'] = 'datetime';
  $views_field['sort']['field_name'] = $field_definition
    ->getName();
}