- Fixed a bug caused by JsonSerialization and old code accessing attributes.

- Fixed Checkbox and Radio checked using a 4th option parameter
This commit is contained in:
Dave Mc Nicoll committed 2020-04-09 14:35:24 -04:00
1 parent 23e8eb71f6
commit 48536ab11d
4 files changed
+51 -22

No files matched your search

+22 -4
View File
@@ -21,15 +21,29 @@ class UiInput extends UiElement implements Extension {
'tag-type' => "single",
];
protected ? string $value;
protected string $name;
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) : string
{
return "<?php echo ( new \\" . static::class . "() )->buildHtml($arguments) ?>";
}
public function buildHtml(string $name, ? string $value = null, array $attributes = []) : string
public function buildHtml(string $name, ? string $value = null, array $attributes = [], array $options = []) : string
{
$this->setValue($value);
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes);
$this->name = $name;
if (null !== $this->value = $value) {
$this->setValue($value);
}
if ($options) {
$this->options += $options;
}
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes + $this->objectAttribute());
return $this->render();
}
@@ -37,5 +51,9 @@ class UiInput extends UiElement implements Extension {
{
$this->attributes['value'] = $value;
}
protected function objectAttribute() : array
{
return [];
}
}