You are here

public static function CRM_Utils_Type::getDataTypeFromFieldMetadata in CiviCRM Entity 8.3

Get the data_type for the field.

Parameters

array $fieldMetadata: Metadata about the field.

Return value

string

File

tests/src/Type.php, line 155

Class

CRM_Utils_Type
@package CRM @copyright CiviCRM LLC (c) 2004-2017

Code

public static function getDataTypeFromFieldMetadata($fieldMetadata) {
  if (isset($fieldMetadata['data_type'])) {
    return $fieldMetadata['data_type'];
  }
  if (empty($fieldMetadata['type'])) {

    // I would prefer to throw an e-notice but there is some,
    // probably unnecessary logic, that only retrieves activity fields
    // if they are 'in the profile' and probably they are not 'in'
    // until they are added - which might lead to ? who knows!
    return '';
  }
  return self::typeToString($fieldMetadata['type']);
}