diff --git a/src/FormAl/Elements/Datepicker.php b/src/FormAl/Elements/Datepicker.php index c8d80d1..946fe37 100644 --- a/src/FormAl/Elements/Datepicker.php +++ b/src/FormAl/Elements/Datepicker.php @@ -20,6 +20,13 @@ class Datepicker extends ElementBase /** @var bool */ private $isRequired = false; + /** @var bool */ + private $isDisabled = false; + + public function setDisabled(bool $disabled){ + $this->isDisabled = $disabled; + } + /** * @param string $text * @@ -78,6 +85,10 @@ public function render() ->attr('name', $this->getName()) ->attr('id', $this->getName()); + if($this->isDisabled){ + $element->attr('disabled', 'disabled'); + } + $dateStr = $this->getValue(); if ($dateStr instanceof \DateTime) { $dateStr = $dateStr->format("d-m-Y H:i");