Changed whole Input Objects

they now lives by themselves when before
they where highly connected to Form.php
This commit is contained in:
2019-04-25 16:14:25 +02:00
parent 90a69fd16c
commit cacdc2c3d6
6 changed files with 190 additions and 55 deletions

View File

@ -2,6 +2,26 @@
namespace AdminPanel\Form;
use DateTime;
class DateInput extends AbstractInput
{
public function getOption(string $name)
{
if ($name === "value") {
return new DateTime($this->options["name"]);
} else {
return parent::getOption($name);
}
}
public function setOption($name, $value)
{
if ($name === "value") {
$this->attributes["value"] = (new DateTime($value))->format('Y-m-d');
} else {
parent::setOption($name, $value);
}
}
}