You are here

protected function CivicrmEntityViewsData::getViewsArgumentPlugin in CiviCRM Entity 8.3

Get the views argument handler.

Parameters

array $field_metadata: An array of field metadata.

Return value

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

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

File

src/CivicrmEntityViewsData.php, line 738

Class

CivicrmEntityViewsData

Namespace

Drupal\civicrm_entity

Code

protected function getViewsArgumentPlugin(array $field_metadata) {
  $type = \CRM_Utils_Array::value($field_metadata['data_type'], \CRM_Core_BAO_CustomField::dataToType());
  switch ($type) {
    case \CRM_Utils_Type::T_INT:
    case \CRM_Utils_Type::T_FLOAT:
    case \CRM_Utils_Type::T_MONEY:
      return [
        'id' => 'numeric',
      ];
    case \CRM_Utils_Type::T_ENUM:
    case \CRM_Utils_Type::T_STRING:
    case \CRM_Utils_Type::T_TEXT:
    case \CRM_Utils_Type::T_LONGTEXT:
    case \CRM_Utils_Type::T_URL:
    case \CRM_Utils_Type::T_EMAIL:
      return [
        'id' => 'string',
      ];
    case \CRM_Utils_Type::T_DATE:
    case \CRM_Utils_Type::T_TIMESTAMP:
      return [
        'id' => 'civicrm_entity_date',
      ];
    default:
      return [
        'id' => 'standard',
      ];
  }
}