You are here

protected function CivicrmEntityViewsData::getViewsSortPlugin in CiviCRM Entity 8.3

Get the views filter handler.

Parameters

array $field_metadata: An array of field metadata.

Return value

array An array containing the corresponding values for the 'sort' key.

1 call to CivicrmEntityViewsData::getViewsSortPlugin()
CivicrmEntityViewsData::processViewsDataForCustomFields in src/CivicrmEntityViewsData.php
Add views integration for custom fields.

File

src/CivicrmEntityViewsData.php, line 632

Class

CivicrmEntityViewsData

Namespace

Drupal\civicrm_entity

Code

protected function getViewsSortPlugin(array $field_metadata) {
  $type = \CRM_Utils_Array::value($field_metadata['data_type'], \CRM_Core_BAO_CustomField::dataToType());
  switch ($type) {
    case \CRM_Utils_Type::T_DATE:
    case \CRM_Utils_Type::T_TIMESTAMP:
      return [
        'id' => 'date',
      ];
    default:
      return [
        'id' => 'standard',
      ];
  }
}