/**
* Sets the size property of a textfield.
- * See constants defined in CRM_Utils_Type for possible values
*/
protected function getSize($fieldXML) {
// Extract from <size> tag if supplied
if (!empty($fieldXML->html) && $this->value('size', $fieldXML->html)) {
- $const = 'CRM_Utils_Type::' . strtoupper($fieldXML->html->size);
- if (defined($const)) {
- return $const;
- }
+ return $this->value('size', $fieldXML->html);
}
// Infer from <length> tag if <size> was not explicitly set or was invalid
-
- // 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';
+ return $fieldXML->length;
}
}
<length>64</length>
<html>
<type>Text</type>
- <size>EIGHT</size>
+ <size>8</size>
</html>
<import>true</import>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<export>true</export>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<export>true</export>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<add>1.1</add>
<html>
<type>File</type>
- <size>BIG</size>
+ <size>30</size>
</html>
</field>
<field>
<length>255</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<length>64</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^first|(f(irst\s)?name)$/i</headerPattern>
<length>64</length>
<html>
<type>Text</type>
- <size>MEDIUM</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^middle|(m(iddle\s)?name)$/i</headerPattern>
<length>64</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^last|(l(ast\s)?name)$/i</headerPattern>
<length>255</length>
<html>
<type>Text</type>
- <size>MEDIUM</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^job|(j(ob\s)?title)$/i</headerPattern>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^household|(h(ousehold\s)?name)$/i</headerPattern>
<length>128</length>
<html>
<type>Text</type>
- <size>BIG</size>
+ <size>30</size>
</html>
<import>true</import>
<headerPattern>/^organization|(o(rganization\s)?name)$/i</headerPattern>