This commit is contained in:
isUnknown 2025-10-02 12:42:15 +02:00
parent bf23084e48
commit 5deb07f09d
19 changed files with 8 additions and 487 deletions

View file

@ -1,34 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Block extends Model
{
public const CLASS_ALIAS = 'block';
protected $toArray = [
'content',
'id',
'isEmpty',
'isHidden',
'type'
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForSiblings(),
[
'content',
'id',
'isEmpty',
'isHidden',
'isNotEmpty',
'toField',
'toHtml',
'parent',
'type'
]
);
}
}

View file

@ -1,24 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Blocks extends Collection
{
public const CLASS_ALIAS = 'blocks';
public function allowedMethods(): array
{
return array_merge(
parent::allowedMethods(),
[
'excerpt',
'toHtml'
]
);
}
public function toArray(): array
{
return $this->object->toArray();
}
}

View file

@ -1,71 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class File extends Model
{
public const CLASS_ALIAS = 'file';
protected $toArray = [
'extension',
'filename',
'height',
'id',
'mime',
'niceSize',
'template',
'type',
'url',
'width'
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForModels(),
$this->allowedMethodsForParents(),
$this->allowedMethodsForSiblings(),
[
'blur',
'bw',
'crop',
'dataUri',
'dimensions',
'exif',
'extension',
'filename',
'files',
'grayscale',
'greyscale',
'height',
'html',
'isPortrait',
'isLandscape',
'isSquare',
'mime',
'name',
'niceSize',
'orientation',
'ratio',
'resize',
'size',
'srcset',
'template',
'templateSiblings',
'thumb',
'type',
'width'
]
);
}
public function dimensions(): array
{
return $this->object->dimensions()->toArray();
}
public function exif(): array
{
return $this->object->exif()->toArray();
}
}

View file

@ -1,8 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class FileVersion extends File
{
public const CLASS_ALIAS = 'file';
}

View file

@ -1,18 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Files extends Collection
{
public const CLASS_ALIAS = 'files';
public function allowedMethods(): array
{
return array_merge(
parent::allowedMethods(),
[
'template'
]
);
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Layout extends Model
{
public const CLASS_ALIAS = 'layout';
protected $toArray = [
'attrs',
'columns',
'id',
'isEmpty',
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForSiblings(),
[
'attrs',
'columns',
'id',
'isEmpty',
'isNotEmpty',
'parent'
]
);
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class LayoutColumn extends Model
{
public const CLASS_ALIAS = 'layoutColumn';
protected $toArray = [
'blocks',
'id',
'isEmpty',
'width',
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForSiblings(),
[
'blocks',
'id',
'isEmpty',
'isNotEmpty',
'span',
'width'
]
);
}
}

View file

@ -1,13 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class LayoutColumns extends Collection
{
public const CLASS_ALIAS = 'layoutColumns';
public function toArray(): array
{
return $this->object->toArray();
}
}

View file

@ -1,13 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Layouts extends Collection
{
public const CLASS_ALIAS = 'layouts';
public function toArray(): array
{
return $this->object->toArray();
}
}

View file

@ -1,68 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Page extends Model
{
public const CLASS_ALIAS = 'page';
protected $toArray = [
'children',
'content',
'drafts',
'files',
'id',
'intendedTemplate',
'isHomePage',
'isErrorPage',
'num',
'template',
'title',
'slug',
'status',
'uid',
'url'
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForChildren(),
$this->allowedMethodsForFiles(),
$this->allowedMethodsForModels(),
$this->allowedMethodsForParents(),
$this->allowedMethodsForSiblings(),
[
'blueprints',
'depth',
'hasTemplate',
'intendedTemplate',
'isDraft',
'isErrorPage',
'isHomePage',
'isHomeOrErrorPage',
'isListed',
'isReadable',
'isSortable',
'isUnlisted',
'num',
'slug',
'status',
'template',
'title',
'uid',
'uri',
]
);
}
public function intendedTemplate(): string
{
return $this->object->intendedTemplate()->name();
}
public function template(): string
{
return $this->object->template()->name();
}
}

View file

@ -1,34 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Pages extends Collection
{
public const CLASS_ALIAS = 'pages';
public function allowedMethods(): array
{
return array_merge(
parent::allowedMethods(),
[
'audio',
'children',
'code',
'documents',
'drafts',
'files',
'findByUri',
'images',
'index',
'listed',
'notTemplate',
'nums',
'published',
'search',
'template',
'unlisted',
'videos',
]
);
}
}

View file

@ -1,36 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Site extends Model
{
public const CLASS_ALIAS = 'site';
protected $toArray = [
'children',
'drafts',
'files',
'title',
'url',
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForChildren(),
$this->allowedMethodsForFiles(),
$this->allowedMethodsForModels(),
[
'blueprints',
'breadcrumb',
'errorPage',
'errorPageId',
'homePage',
'homePageId',
'page',
'pages',
'title',
]
);
}
}

View file

@ -1,13 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Structure extends Collection
{
public const CLASS_ALIAS = 'structure';
public function toArray(): array
{
return $this->object->toArray();
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class StructureObject extends Model
{
public const CLASS_ALIAS = 'structureItem';
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForSiblings(),
[
'content',
'id',
'parent',
]
);
}
}

View file

@ -1,35 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class User extends Model
{
public const CLASS_ALIAS = 'user';
protected $toArray = [
'id',
'name',
'role',
'username'
];
public function allowedMethods(): array
{
return array_merge(
$this->allowedMethodsForFiles(),
$this->allowedMethodsForModels(),
$this->allowedMethodsForSiblings(),
[
'avatar',
'email',
'id',
'isAdmin',
'language',
'modified',
'name',
'role',
'username',
]
);
}
}

View file

@ -1,18 +0,0 @@
<?php
namespace Kirby\Kql\Interceptors\Cms;
class Users extends Collection
{
public const CLASS_ALIAS = 'users';
public function allowedMethods(): array
{
return array_merge(
parent::allowedMethods(),
[
'role'
]
);
}
}