Enable creation of new entries via templates

This commit is contained in:
2025-06-11 19:28:38 +09:30
parent 820f398c2c
commit 9f0290bd40
7 changed files with 100 additions and 22 deletions

View File

@@ -30,15 +30,20 @@ class Template
public function __get(string $key): mixed
{
return match ($key) {
'attributes' => array_map('strtolower',array_keys(Arr::get($this->template,$key))),
'objectclasses' => array_map('strtolower',Arr::get($this->template,$key)),
'enabled' => Arr::get($this->template,$key,FALSE),
'icon','regexp' => Arr::get($this->template,$key),
'attributes' => collect(array_map('strtolower',array_keys(Arr::get($this->template,$key)))),
'objectclasses' => collect(array_map('strtolower',Arr::get($this->template,$key))),
'enabled' => Arr::get($this->template,$key,FALSE) && (! $this->invalid),
'icon','regexp','title' => Arr::get($this->template,$key),
default => throw new \Exception('Unknown key: '.$key),
};
}
public function __isset(string $key): bool
{
return array_key_exists($key,$this->template);
}
public function __toString(): string
{
return $this->invalid ? '' : Arr::get($this->template,'title','No Template Name');