Skip to content

Commit 853cec3

Browse files
authored
Merge pull request #30 from dmdrozd/master
Checking if form is not defined
2 parents 1af419a + ff22c11 commit 853cec3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Form/Element.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ public function render()
174174

175175
public function disableIfNeeded()
176176
{
177-
if ($this->isDisabled || $this->form->isDisabled())
177+
$isElementDisabled = $this->isDisabled;
178+
$isFormDisabled = $this->form ? $this->form->isDisabled() : false;
179+
180+
if ($isElementDisabled || $isFormDisabled)
178181
{
179182
$this->addAttributes(['disabled' => 'disabled']);
180183
}

0 commit comments

Comments
 (0)