Skip to content

Commit

Permalink
Added function for disabled datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
spidfire committed Jan 11, 2021
1 parent 75192bf commit 6cc017a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/FormAl/Elements/Datepicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 6cc017a

Please sign in to comment.