fixing multiple references

This commit is contained in:
2024-08-27 12:24:51 +03:00
parent ffc39f078d
commit 82174afdea
23 changed files with 114 additions and 1000 deletions
-46
View File
@@ -1,46 +0,0 @@
<?php
namespace Lucent\Schema\Ui;
use Lucent\Schema\FieldInfo;
use Lucent\Schema\FieldInterface;
use Lucent\Schema\FieldType;
use Lucent\Schema\Nullable;
use Lucent\Schema\Validator\RequiredInterface;
class Block implements FieldInterface, RequiredInterface
{
public FieldInfo $info;
public function __construct(
public string $name,
public string $label,
public bool $nullable = false,
public bool $required = false,
public string $default = "",
public string $help = "",
public bool $readonly = false,
public string $schema = "",
public string $group = "",
)
{
$this->info = new FieldInfo("block", "Block editor", FieldType::JSON);
}
public function format(array $input, array $output): array
{
$value = $input[$this->name] ?? null;
if (is_string($value)) {
$value = json_decode($value, true);
}
$output[$this->name] = (new Nullable($this->nullable, $value, []))->value();
return $output;
}
public function failRequired(mixed $value): bool
{
return empty($value);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ class Checkbox implements FieldInterface, RequiredInterface
public string $group = "",
)
{
$this->info = new FieldInfo("checkbox", "Block Checkbox", FieldType::BOOLEAN);
$this->info = new FieldInfo("checkbox", "Checkbox", FieldType::BOOLEAN);
}
public function format(array $input, array $output): array