From 47497648d7ca5082ba386d8c1fbbc14cc5cd80f3 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 19 Nov 2016 09:31:17 +1100 Subject: [PATCH] Backport validateAll function to 4.6 --- CRM/Utils/Type.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index c1bd663f9c..038d49713e 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -299,6 +299,18 @@ class CRM_Utils_Type { return NULL; } + /** + * Helper function to call validate on arrays + * + * @see validate + */ + public static function validateAll($data, $type, $abort = TRUE) { + foreach ($data as $key => $value) { + $data[$key] = CRM_Utils_Type::validate($value, $type, $abort); + } + return $data; + } + /** * Verify that a variable is of a given type. * -- 2.25.1