Add objects directly to Entry::class when rendering a template. Fix objectclasses and attributes processing for templates

This commit is contained in:
2025-06-16 23:04:07 +10:00
parent 88db4ccc99
commit 98a0b87afe
6 changed files with 49 additions and 11 deletions

View File

@@ -31,11 +31,12 @@ class Template
public function __get(string $key): mixed
{
return match ($key) {
'name' => Str::replaceEnd('.json','',$this->file),
'attributes' => collect(array_map('strtolower',array_keys(Arr::get($this->template,$key)))),
'objectclasses' => collect(array_map('strtolower',Arr::get($this->template,$key))),
'attributes' => collect(Arr::get($this->template,$key))->keys(),
'enabled' => Arr::get($this->template,$key,FALSE) && (! $this->invalid),
'icon','regexp','title' => Arr::get($this->template,$key),
'name' => Str::replaceEnd('.json','',$this->file),
'objectclasses' => collect(Arr::get($this->template,$key)),
'order' => collect(Arr::get($this->template,'attributes'))->map(fn($item)=>$item['order']),
default => throw new \Exception('Unknown key: '.$key),
};