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

@ -5,9 +5,10 @@ use Kirby\Toolkit\A;
return [
'mixins' => [
'picker',
'filepicker',
'layout',
'min',
'picker',
'upload'
],
'props' => [
@ -27,20 +28,6 @@ return [
return $default;
},
/**
* Changes the layout of the selected files. Available layouts: `list`, `cards`
*/
'layout' => function (string $layout = 'list') {
return $layout;
},
/**
* Layout size for cards: `tiny`, `small`, `medium`, `large` or `huge`
*/
'size' => function (string $size = 'auto') {
return $size;
},
'value' => function ($value = null) {
return $value;
}
@ -68,11 +55,12 @@ return [
],
'methods' => [
'fileResponse' => function ($file) {
return $file->panelPickerData([
'image' => $this->image,
'info' => $this->info ?? false,
'model' => $this->model(),
'text' => $this->text,
return $file->panel()->pickerData([
'image' => $this->image,
'info' => $this->info ?? false,
'layout' => $this->layout,
'model' => $this->model(),
'text' => $this->text,
]);
},
'toFiles' => function ($value = null) {
@ -101,6 +89,7 @@ return [
return $field->filepicker([
'image' => $field->image(),
'info' => $field->info(),
'layout' => $field->layout(),
'limit' => $field->limit(),
'page' => $this->requestQuery('page'),
'query' => $field->query(),
@ -116,14 +105,18 @@ return [
$field = $this->field();
$uploads = $field->uploads();
// move_uploaded_file() not working with unit test
// @codeCoverageIgnoreStart
return $field->upload($this, $uploads, function ($file, $parent) use ($field) {
return $file->panelPickerData([
'image' => $field->image(),
'info' => $field->info(),
'model' => $field->model(),
'text' => $field->text(),
return $file->panel()->pickerData([
'image' => $field->image(),
'info' => $field->info(),
'layout' => $field->layout(),
'model' => $field->model(),
'text' => $field->text(),
]);
});
// @codeCoverageIgnoreEnd
}
]
];

View file

@ -34,7 +34,7 @@ return [
'computed' => [
'text' => function () {
if ($text = $this->text) {
$text = $this->model()->toString($text);
$text = $this->model()->toSafeString($text);
$text = $this->kirby()->kirbytext($text);
return $text;
}

View file

@ -0,0 +1,21 @@
<?php
return [
'props' => [
/**
* Changes the layout of the selected entries.
* Available layouts: `list`, `cardlets`, `cards`
*/
'layout' => function (string $layout = 'list') {
$layouts = ['list', 'cardlets', 'cards'];
return in_array($layout, $layouts) ? $layout : 'list';
},
/**
* Layout size for cards: `tiny`, `small`, `medium`, `large` or `huge`
*/
'size' => function (string $size = 'auto') {
return $size;
},
]
];

View file

@ -27,6 +27,7 @@ return [
if ($template) {
$file = new File([
'filename' => 'tmp',
'parent' => $this->model(),
'template' => $template
]);

View file

@ -4,7 +4,12 @@ use Kirby\Data\Data;
use Kirby\Toolkit\A;
return [
'mixins' => ['min', 'pagepicker', 'picker'],
'mixins' => [
'layout',
'min',
'pagepicker',
'picker',
],
'props' => [
/**
* Unset inherited props
@ -22,13 +27,6 @@ return [
return $this->toPages($default);
},
/**
* Changes the layout of the selected files. Available layouts: `list`, `cards`
*/
'layout' => function (string $layout = 'list') {
return $layout;
},
/**
* Optional query to select a specific set of pages
*/
@ -36,13 +34,6 @@ return [
return $query;
},
/**
* Layout size for cards: `tiny`, `small`, `medium`, `large` or `huge`
*/
'size' => function (string $size = 'auto') {
return $size;
},
/**
* Optionally include subpages of pages
*/
@ -62,10 +53,11 @@ return [
],
'methods' => [
'pageResponse' => function ($page) {
return $page->panelPickerData([
'image' => $this->image,
'info' => $this->info,
'text' => $this->text,
return $page->panel()->pickerData([
'image' => $this->image,
'info' => $this->info,
'layout' => $this->layout,
'text' => $this->text,
]);
},
'toPages' => function ($value = null) {
@ -95,6 +87,7 @@ return [
return $field->pagepicker([
'image' => $field->image(),
'info' => $field->info(),
'layout' => $field->layout(),
'limit' => $field->limit(),
'page' => $this->requestQuery('page'),
'parent' => $this->requestQuery('parent'),

View file

@ -0,0 +1,55 @@
<?php
return [
'extends' => 'text',
'props' => [
/**
* Unset inherited props
*/
'converter' => null,
'counter' => null,
'spellcheck' => null,
/**
* Set of characters allowed in the slug
*/
'allow' => function (string $allow = '') {
return $allow;
},
/**
* Changes the link icon
*/
'icon' => function (string $icon = 'url') {
return $icon;
},
/**
* Set prefix for the help text
*/
'path' => function (string $path = null) {
return $path;
},
/**
* Name of another field that should be used to
* automatically update this field's value
*/
'sync' => function (string $sync = null) {
return $sync;
},
/**
* Set to object with keys `field` and `text` to add
* button to generate from another field
*/
'wizard' => function ($wizard = false) {
return $wizard;
}
],
'validations' => [
'minlength',
'maxlength'
],
];

View file

@ -1,7 +1,7 @@
<?php
use Kirby\Cms\Form;
use Kirby\Data\Data;
use Kirby\Form\Form;
use Kirby\Toolkit\I18n;
return [

View file

@ -109,7 +109,7 @@ return [
return [
'filename' => $file->filename(),
'dragText' => $file->dragText('auto', $absolute),
'dragText' => $file->panel()->dragText('auto', $absolute),
];
});
}

View file

@ -1,6 +1,7 @@
<?php
use Kirby\Exception\InvalidArgumentException;
use Kirby\Toolkit\A;
use Kirby\Toolkit\I18n;
return [
@ -20,19 +21,25 @@ return [
* Sets the text next to the toggle. The text can be a string or an array of two options. The first one is the negative text and the second one the positive. The text will automatically switch when the toggle is triggered.
*/
'text' => function ($value = null) {
$model = $this->model();
if (is_array($value) === true) {
if (A::isAssociative($value) === true) {
return I18n::translate($value, $value);
return $model->toSafeString(I18n::translate($value, $value));
}
foreach ($value as $key => $val) {
$value[$key] = I18n::translate($val, $val);
$value[$key] = $model->toSafeString(I18n::translate($val, $val));
}
return $value;
}
return I18n::translate($value, $value);
if (empty($value) === false) {
return $model->toSafeString(I18n::translate($value, $value));
}
return $value;
},
],
'computed' => [

View file

@ -4,7 +4,12 @@ use Kirby\Data\Data;
use Kirby\Toolkit\A;
return [
'mixins' => ['min', 'picker', 'userpicker'],
'mixins' => [
'layout',
'min',
'picker',
'userpicker'
],
'props' => [
/**
* Unset inherited props
@ -44,10 +49,11 @@ return [
],
'methods' => [
'userResponse' => function ($user) {
return $user->panelPickerData([
'info' => $this->info,
'image' => $this->image,
'text' => $this->text,
return $user->panel()->pickerData([
'info' => $this->info,
'image' => $this->image,
'layout' => $this->layout,
'text' => $this->text,
]);
},
'toUsers' => function ($value = null) {
@ -77,6 +83,7 @@ return [
return $field->userpicker([
'image' => $field->image(),
'info' => $field->info(),
'layout' => $field->layout(),
'limit' => $field->limit(),
'page' => $this->requestQuery('page'),
'query' => $field->query(),

View file

@ -1,5 +1,7 @@
<?php
use Kirby\Sane\Sane;
return [
'props' => [
/**
@ -11,14 +13,14 @@ return [
return $inline;
},
/**
* Sets the allowed HTML formats. Available formats: `bold`, `italic`, `underline`, `strike`, `code`, `link`. Activate them all by passing `true`. Deactivate them all by passing `false`
* Sets the allowed HTML formats. Available formats: `bold`, `italic`, `underline`, `strike`, `code`, `link`, `email`. Activate them all by passing `true`. Deactivate them all by passing `false`
* @param array|bool $marks
*/
'marks' => function ($marks = true) {
return $marks;
},
/**
* Sets the allowed nodes. Available nodes: `bulletList`, `orderedList`, `heading`, `horizontalRule`, `listItem`. Activate/deactivate them all by passing `true`/`false`. Default nodes are `heading`, `bulletList`, `orderedList`.
* Sets the allowed nodes. Available nodes: `paragraph`, `heading`, `bulletList`, `orderedList`. Activate/deactivate them all by passing `true`/`false`. Default nodes are `paragraph`, `heading`, `bulletList`, `orderedList`.
* @param array|bool|null $nodes
*/
'nodes' => function ($nodes = null) {
@ -27,7 +29,7 @@ return [
],
'computed' => [
'value' => function () {
return trim($this->value);
return Sane::sanitize(trim($this->value), 'html');
}
],
];