File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -124,13 +124,16 @@ public static function submit(string $caption = ''): Input
124124 return $ input ;
125125 }
126126
127- public static function textarea (string $ name = '' , string $ placeholder = '' ): TextArea
127+ public static function textarea (string $ name = '' , int $ rows = 5 , string $ placeholder = '' ): TextArea
128128 {
129129 /** @var TextArea */
130130 $ textarea = self ::create ('TextArea ' );
131131 if ($ name ) {
132132 $ textarea ->name ($ name );
133133 }
134+ if ($ rows ) {
135+ $ textarea ->rows ($ rows );
136+ }
134137 if ($ placeholder ) {
135138 $ textarea ->placeholder ($ placeholder );
136139 }
Original file line number Diff line number Diff line change @@ -9,11 +9,19 @@ class TextArea extends Input
99{
1010 use HtmlElement;
1111
12+ protected int $ rows = 0 ;
13+
1214 public function __construct ()
1315 {
1416 $ this ->tag ('textarea ' );
1517 }
1618
19+ public function rows (int $ rows ): self
20+ {
21+ $ this ->rows = $ rows ;
22+ return $ this ;
23+ }
24+
1725 public function name (string $ name ): self
1826 {
1927 $ this ->name = $ name ;
@@ -53,6 +61,9 @@ public function setError(string $message): void {}
5361 public function renderDom (\DOMDocument $ doc ): \DOMElement
5462 {
5563 $ textarea = $ this ->renderElement ($ doc );
64+ if ($ this ->rows > 0 ) {
65+ $ textarea ->setAttribute ('rows ' , strval ($ this ->rows ));
66+ }
5667 $ textarea ->setAttribute ('name ' , $ this ->name );
5768 $ textarea ->textContent = $ this ->value ;
5869 return $ textarea ;
You can’t perform that action at this time.
0 commit comments