Skip to content

Commit

Permalink
Revert: Forms: $cols & $rows do not trigger error
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 11, 2014
1 parent d5914a5 commit 190c113
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
17 changes: 4 additions & 13 deletions src/Forms/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,7 @@ public function getForm($need = TRUE)
public function addText($name, $label = NULL, $cols = NULL, $maxLength = NULL)
{
$control = new Controls\TextInput($label, $maxLength);
if ($cols) {
trigger_error(__METHOD__ . '() third parameter $cols is deprecated, use setAttribute("size", ...).', E_USER_DEPRECATED);
$control->setAttribute('size', $cols);
}
$control->setAttribute('size', $cols);
return $this[$name] = $control;
}

Expand All @@ -250,10 +247,7 @@ public function addText($name, $label = NULL, $cols = NULL, $maxLength = NULL)
public function addPassword($name, $label = NULL, $cols = NULL, $maxLength = NULL)
{
$control = new Controls\TextInput($label, $maxLength);
if ($cols) {
trigger_error(__METHOD__ . '() third parameter $cols is deprecated, use setAttribute("size", ...).', E_USER_DEPRECATED);
$control->setAttribute('size', $cols);
}
$control->setAttribute('size', $cols);
return $this[$name] = $control->setType('password');
}

Expand All @@ -269,11 +263,8 @@ public function addPassword($name, $label = NULL, $cols = NULL, $maxLength = NUL
public function addTextArea($name, $label = NULL, $cols = NULL, $rows = NULL)
{
$control = new Controls\TextArea($label);
if ($cols) {
trigger_error(__METHOD__ . '() parameters $cols is deprecated, use setAttribute("cols", ...).', E_USER_DEPRECATED);
$control->setAttribute('cols', $cols);
}
return $this[$name] = $control->setAttribute('rows', $rows);
$control->setAttribute('cols', $cols)->setAttribute('rows', $rows);
return $this[$name] = $control;
}


Expand Down
4 changes: 2 additions & 2 deletions tests/Forms.Latte/expected/FormMacros.forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<input type="hidden" name="id" id="frm-id" value="" title="Hello" size="10">
<label for="frm-username">Username:</label>
<input type="text" name="username" id="frm-username" value="" title="Hello" size="10"> error
<input type="text" name="username" size="10" id="frm-username" value="" title="Hello"> error
error
<br>

<label for="frm-username" title="hello"> <input type="text" name="username" id="frm-username" value="" title="Hello" size="10"> </label>
<label for="frm-username" title="hello"> <input type="text" name="username" size="10" id="frm-username" value="" title="Hello"> </label>
error <label for="frm-select"></label>
<select name="select" id="frm-select" title="Hello" size="10"><option value="m">male</option><option value="f">female</option></select>

Expand Down

0 comments on commit 190c113

Please sign in to comment.