From f53213b2eb48038103f840ffc95a6698df7137f7 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Tue, 16 Jun 2015 16:52:03 +0200 Subject: [PATCH] CRM-16629 revert default lengths of text-fields --- CRM/Core/CodeGen/Specification.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 516a11e326..1d6b98b2e5 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -667,7 +667,23 @@ class CRM_Core_CodeGen_Specification { return $this->value('size', $fieldXML->html); } // Infer from tag if was not explicitly set or was invalid - return $fieldXML->length; + // This map is slightly different from CRM_Core_Form_Renderer::$_sizeMapper + // Because we usually want fields to render as smaller than their maxlength + $sizes = array( + 2 => 'TWO', + 4 => 'FOUR', + 6 => 'SIX', + 8 => 'EIGHT', + 16 => 'TWELVE', + 32 => 'MEDIUM', + 64 => 'BIG', + ); + foreach ($sizes as $length => $name) { + if ($fieldXML->length <= $length) { + return "CRM_Utils_Type::$name"; + } + } + return 'CRM_Utils_Type::HUGE'; } } -- 2.25.1