13
13
14
14
use Magento \Framework \Escaper ;
15
15
16
+ /**
17
+ * @method Textarea setExtType($extType)
18
+ * @method mixed getCols()
19
+ * @method Textarea setCols($cols)
20
+ * @method mixed getRows()
21
+ * @method Textarea setRows($rows)
22
+ */
16
23
class Textarea extends AbstractElement
17
24
{
25
+ /**
26
+ * default number of rows
27
+ *
28
+ * @var int
29
+ */
30
+ const DEFAULT_ROWS = 2 ;
31
+ /**
32
+ * default number of cols
33
+ *
34
+ * @var int
35
+ */
36
+ const DEFAULT_COLS = 15 ;
37
+
18
38
/**
19
39
* @param Factory $factoryElement
20
40
* @param CollectionFactory $factoryCollection
@@ -30,8 +50,12 @@ public function __construct(
30
50
parent ::__construct ($ factoryElement , $ factoryCollection , $ escaper , $ data );
31
51
$ this ->setType ('textarea ' );
32
52
$ this ->setExtType ('textarea ' );
33
- $ this ->setRows (2 );
34
- $ this ->setCols (15 );
53
+ if (!$ this ->getRows ()) {
54
+ $ this ->setRows (self ::DEFAULT_ROWS );
55
+ }
56
+ if (!$ this ->getCols ()) {
57
+ $ this ->setCols (self ::DEFAULT_COLS );
58
+ }
35
59
}
36
60
37
61
/**
@@ -66,8 +90,8 @@ public function getElementHtml()
66
90
{
67
91
$ this ->addClass ('textarea ' );
68
92
$ html = '<textarea id=" ' . $ this ->getHtmlId () . '" name=" ' . $ this ->getName () . '" ' . $ this ->serialize (
69
- $ this ->getHtmlAttributes ()
70
- ) . $ this ->_getUiId () . ' > ' ;
93
+ $ this ->getHtmlAttributes ()
94
+ ) . $ this ->_getUiId () . ' > ' ;
71
95
$ html .= $ this ->getEscapedValue ();
72
96
$ html .= "</textarea> " ;
73
97
$ html .= $ this ->getAfterElementHtml ();
0 commit comments