From 067c2e09ee7d164f7172fa2314025cac3a798dfd Mon Sep 17 00:00:00 2001 From: mickadoo Date: Fri, 9 Jun 2017 15:01:57 +0100 Subject: [PATCH] CRM-20710: Add function to return valid types --- CRM/Utils/Type.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 43b920f8be4b..df97cab87f27 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -143,6 +143,28 @@ public static function typeToString($type) { return (isset($string)) ? $string : ""; } + /** + * @return array + * An array of type in the form 'type name' => 'int representing type' + */ + public static function getValidTypes() { + return array( + 'Int' => self::T_INT, + 'String' => self::T_STRING, + 'Enum' => self::T_ENUM, + 'Date' => self::T_DATE, + 'Time' => self::T_TIME, + 'Boolean' => self::T_BOOLEAN, + 'Text' => self::T_TEXT, + 'Blob' => self::T_BLOB, + 'Timestamp' => self::T_TIMESTAMP, + 'Float' => self::T_FLOAT, + 'Money' => self::T_MONEY, + 'Email' => self::T_EMAIL, + 'Mediumblob' => self::T_MEDIUMBLOB, + ); + } + /** * Get the data_type for the field. * @@ -518,7 +540,7 @@ public static function mysqlOrderByCallback($matches) { } /** - * Get list of avaliable Data Tupes for Option Groups + * Get list of avaliable Data Types for Option Groups * * @return array */