Add blueprints and fake content

This commit is contained in:
Paul Nicoué 2021-11-18 17:44:47 +01:00
parent 1ff19bf38f
commit 8235816462
592 changed files with 22385 additions and 31535 deletions

View file

@ -1,7 +1,6 @@
<?php
use Kirby\Cms\File;
use Kirby\Toolkit\Escape;
use Kirby\Toolkit\I18n;
return [
@ -29,7 +28,7 @@ return [
return $image ?? [];
},
/**
* Optional info text setup. Info text is shown on the right (lists) or below (cards) the filename.
* Optional info text setup. Info text is shown on the right (lists, cardlets) or below (cards) the filename.
*/
'info' => function ($info = null) {
return I18n::translate($info, $info);
@ -70,6 +69,7 @@ return [
if ($this->template) {
$file = new File([
'filename' => 'tmp',
'parent' => $this->model(),
'template' => $this->template
]);
@ -90,7 +90,7 @@ return [
if ($this->sortBy) {
$files = $files->sort(...$files::sortArgs($this->sortBy));
} else {
$files = $files->sort('sort', 'asc', 'filename', 'asc');
$files = $files->sorted();
}
// flip
@ -115,28 +115,21 @@ return [
$dragTextAbsolute = $this->model->is($this->parent) === false;
foreach ($this->files as $file) {
$image = $file->panelImage($this->image);
// escape the default text
// TODO: no longer needed in 3.6
$text = $file->toString($this->text);
if ($this->text === '{{ file.filename }}') {
$text = Escape::html($text);
}
$panel = $file->panel();
$data[] = [
'dragText' => $file->dragText('auto', $dragTextAbsolute),
'dragText' => $panel->dragText('auto', $dragTextAbsolute),
'extension' => $file->extension(),
'filename' => $file->filename(),
'id' => $file->id(),
'icon' => $file->panelIcon($image),
'image' => $image,
'info' => $file->toString($this->info ?? false),
'link' => $file->panelUrl(true),
'mime' => $file->mime(),
'parent' => $file->parent()->panelPath(),
'text' => $text,
'url' => $file->url(),
'filename' => $file->filename(),
'id' => $file->id(),
'image' => $panel->image($this->image, $this->layout),
'info' => $file->toSafeString($this->info ?? false),
'link' => $panel->url(true),
'mime' => $file->mime(),
'parent' => $file->parent()->panel()->path(),
'template' => $file->template(),
'text' => $file->toSafeString($this->text),
'url' => $file->url(),
];
}
@ -174,8 +167,8 @@ return [
];
},
'link' => function () {
$modelLink = $this->model->panelUrl(true);
$parentLink = $this->parent->panelUrl(true);
$modelLink = $this->model->panel()->url(true);
$parentLink = $this->parent->panel()->url(true);
if ($modelLink !== $parentLink) {
return $parentLink;
@ -222,6 +215,7 @@ return [
'max' => $max,
'api' => $this->parent->apiUrl(true) . '/files',
'attributes' => array_filter([
'sort' => $this->sortable === true ? $total + 1 : null,
'template' => $template
])
];