Skip to content

Commit 9c0f96b

Browse files
authored
Merge pull request #41 from RhubarbPHP/feature/SetDisabled
Easily disable an input
2 parents c9e157c + d174ae0 commit 9c0f96b

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 1.3.11
4+
5+
* Added: Adding a help function to disable the input
6+
37
### 1.3.10
48

59
* Added: --viewBridge option added to create-leaf custard command.

src/Leaves/Controls/Control.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public function setPlaceholderText($placeholderText)
6464
$this->model->addHtmlAttribute("placeholder", $placeholderText);
6565
}
6666

67+
public function setDisabled($disabled)
68+
{
69+
if ($disabled) {
70+
$this->addHtmlAttribute('disabled', 'disabled');
71+
} else {
72+
$this->removeHtmlAttribute('disabled');
73+
}
74+
$this->model->disabled = $disabled;
75+
}
76+
6777
/**
6878
* Returns a label that the hosting view can use in the HTML output.
6979
*

src/Leaves/Controls/ControlModel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class ControlModel extends LeafModel
3030
*/
3131
public $label = "";
3232

33+
public $disabled;
34+
3335
public function __construct()
3436
{
3537
parent::__construct();

0 commit comments

Comments
 (0)