Upgrade to 3.2.5
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\Auth;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
return function () {
|
||||
$auth = $this->kirby()->auth();
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\Files;
|
||||
use Kirby\Cms\Languages;
|
||||
use Kirby\Cms\Pages;
|
||||
use Kirby\Cms\Roles;
|
||||
use Kirby\Cms\Translations;
|
||||
use Kirby\Cms\Users;
|
||||
|
||||
/**
|
||||
* Api Collection Definitions
|
||||
*/
|
||||
@@ -17,7 +10,7 @@ return [
|
||||
*/
|
||||
'children' => [
|
||||
'model' => 'page',
|
||||
'type' => Pages::class,
|
||||
'type' => 'Kirby\Cms\Pages',
|
||||
'view' => 'compact'
|
||||
],
|
||||
|
||||
@@ -26,7 +19,7 @@ return [
|
||||
*/
|
||||
'files' => [
|
||||
'model' => 'file',
|
||||
'type' => Files::class
|
||||
'type' => 'Kirby\Cms\Files'
|
||||
],
|
||||
|
||||
/**
|
||||
@@ -34,7 +27,7 @@ return [
|
||||
*/
|
||||
'languages' => [
|
||||
'model' => 'language',
|
||||
'type' => Languages::class,
|
||||
'type' => 'Kirby\Cms\Languages',
|
||||
'view' => 'compact'
|
||||
],
|
||||
|
||||
@@ -43,7 +36,7 @@ return [
|
||||
*/
|
||||
'pages' => [
|
||||
'model' => 'page',
|
||||
'type' => Pages::class,
|
||||
'type' => 'Kirby\Cms\Pages',
|
||||
'view' => 'compact'
|
||||
],
|
||||
|
||||
@@ -52,7 +45,7 @@ return [
|
||||
*/
|
||||
'roles' => [
|
||||
'model' => 'role',
|
||||
'type' => Roles::class,
|
||||
'type' => 'Kirby\Cms\Roles',
|
||||
'view' => 'compact'
|
||||
],
|
||||
|
||||
@@ -61,7 +54,7 @@ return [
|
||||
*/
|
||||
'translations' => [
|
||||
'model' => 'translation',
|
||||
'type' => Translations::class,
|
||||
'type' => 'Kirby\Cms\Translations',
|
||||
'view' => 'compact'
|
||||
],
|
||||
|
||||
@@ -73,7 +66,7 @@ return [
|
||||
return $this->users();
|
||||
},
|
||||
'model' => 'user',
|
||||
'type' => Users::class,
|
||||
'type' => 'Kirby\Cms\Users',
|
||||
'view' => 'compact'
|
||||
]
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Cms\Page;
|
||||
use Kirby\Cms\Site;
|
||||
|
||||
/**
|
||||
* Api Model Definitions
|
||||
*/
|
||||
|
||||
@@ -115,7 +115,7 @@ return [
|
||||
return $file->url(true);
|
||||
},
|
||||
],
|
||||
'type' => File::class,
|
||||
'type' => 'Kirby\Cms\File',
|
||||
'views' => [
|
||||
'default' => [
|
||||
'content',
|
||||
|
||||
@@ -20,7 +20,7 @@ return [
|
||||
return $blueprint->title();
|
||||
},
|
||||
],
|
||||
'type' => FileBlueprint::class,
|
||||
'type' => 'Kirby\Cms\FileBlueprint',
|
||||
'views' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -44,7 +44,7 @@ return [
|
||||
return $file->url(true);
|
||||
},
|
||||
],
|
||||
'type' => FileVersion::class,
|
||||
'type' => 'Kirby\Cms\FileVersion',
|
||||
'views' => [
|
||||
'default' => [
|
||||
'dimensions',
|
||||
|
||||
@@ -29,7 +29,7 @@ return [
|
||||
return $language->url();
|
||||
},
|
||||
],
|
||||
'type' => Language::class,
|
||||
'type' => 'Kirby\Cms\Language',
|
||||
'views' => [
|
||||
'compact' => [
|
||||
'code',
|
||||
|
||||
@@ -104,7 +104,7 @@ return [
|
||||
return $page->url();
|
||||
},
|
||||
],
|
||||
'type' => Page::class,
|
||||
'type' => 'Kirby\Cms\Page',
|
||||
'views' => [
|
||||
'compact' => [
|
||||
'id',
|
||||
|
||||
@@ -29,7 +29,7 @@ return [
|
||||
return $blueprint->title();
|
||||
},
|
||||
],
|
||||
'type' => PageBlueprint::class,
|
||||
'type' => 'Kirby\Cms\PageBlueprint',
|
||||
'views' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ return [
|
||||
return $role->title();
|
||||
},
|
||||
],
|
||||
'type' => Role::class,
|
||||
'type' => 'Kirby\Cms\Role',
|
||||
'views' => [
|
||||
'compact' => [
|
||||
'description',
|
||||
|
||||
@@ -39,7 +39,7 @@ return [
|
||||
return $site->url();
|
||||
},
|
||||
],
|
||||
'type' => Site::class,
|
||||
'type' => 'Kirby\Cms\Site',
|
||||
'views' => [
|
||||
'compact' => [
|
||||
'title',
|
||||
|
||||
@@ -20,7 +20,7 @@ return [
|
||||
return $blueprint->title();
|
||||
},
|
||||
],
|
||||
'type' => SiteBlueprint::class,
|
||||
'type' => 'Kirby\Cms\SiteBlueprint',
|
||||
'views' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -11,6 +11,9 @@ return [
|
||||
'ascii' => function () {
|
||||
return Str::$ascii;
|
||||
},
|
||||
'defaultLanguage' => function () {
|
||||
return $this->kirby()->option('panel.language', 'en');
|
||||
},
|
||||
'isOk' => function (System $system) {
|
||||
return $system->isOk();
|
||||
},
|
||||
@@ -62,7 +65,7 @@ return [
|
||||
}
|
||||
},
|
||||
'kirbytext' => function () {
|
||||
return $this->kirby()->option('panel')['kirbytext'] ?? true;
|
||||
return $this->kirby()->option('panel.kirbytext') ?? true;
|
||||
},
|
||||
'user' => function () {
|
||||
return $this->user();
|
||||
@@ -71,7 +74,7 @@ return [
|
||||
return $this->kirby()->version();
|
||||
}
|
||||
],
|
||||
'type' => System::class,
|
||||
'type' => 'Kirby\Cms\System',
|
||||
'views' => [
|
||||
'login' => [
|
||||
'isOk',
|
||||
@@ -90,6 +93,7 @@ return [
|
||||
],
|
||||
'panel' => [
|
||||
'ascii',
|
||||
'defaultLanguage',
|
||||
'isOk',
|
||||
'isInstalled',
|
||||
'isLocal',
|
||||
|
||||
@@ -23,7 +23,7 @@ return [
|
||||
return $translation->name();
|
||||
},
|
||||
],
|
||||
'type' => Translation::class,
|
||||
'type' => 'Kirby\Cms\Translation',
|
||||
'views' => [
|
||||
'compact' => [
|
||||
'direction',
|
||||
|
||||
@@ -54,7 +54,7 @@ return [
|
||||
return $user->username();
|
||||
}
|
||||
],
|
||||
'type' => User::class,
|
||||
'type' => 'Kirby\Cms\User',
|
||||
'views' => [
|
||||
'default' => [
|
||||
'avatar',
|
||||
|
||||
@@ -20,7 +20,7 @@ return [
|
||||
return $blueprint->title();
|
||||
},
|
||||
],
|
||||
'type' => UserBlueprint::class,
|
||||
'type' => 'Kirby\Cms\UserBlueprint',
|
||||
'views' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
|
||||
/**
|
||||
* Authentication
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Files Routes
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Page Routes
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,14 @@ return [
|
||||
'pattern' => 'roles',
|
||||
'method' => 'GET',
|
||||
'action' => function () {
|
||||
return $this->kirby()->roles();
|
||||
switch (get('canBe')) {
|
||||
case 'changed':
|
||||
return $this->kirby()->roles()->canBeChanged();
|
||||
case 'created':
|
||||
return $this->kirby()->roles()->canBeCreated();
|
||||
default:
|
||||
return $this->kirby()->roles();
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* System Routes
|
||||
*/
|
||||
@@ -54,11 +57,11 @@ return [
|
||||
}
|
||||
|
||||
if ($system->isInstallable() === false) {
|
||||
throw new Exception('The panel cannot be installed');
|
||||
throw new Exception('The Panel cannot be installed');
|
||||
}
|
||||
|
||||
if ($system->isInstalled() === true) {
|
||||
throw new Exception('The panel is already installed');
|
||||
throw new Exception('The Panel is already installed');
|
||||
}
|
||||
|
||||
// create the first user
|
||||
|
||||
@@ -4,12 +4,8 @@ use Kirby\Cms\App;
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Cms\Filename;
|
||||
use Kirby\Cms\FileVersion;
|
||||
use Kirby\Cms\FileModifications;
|
||||
use Kirby\Cms\Model;
|
||||
use Kirby\Cms\Response;
|
||||
use Kirby\Cms\Template;
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Image\Darkroom;
|
||||
use Kirby\Text\Markdown;
|
||||
use Kirby\Text\SmartyPants;
|
||||
@@ -22,7 +18,7 @@ return [
|
||||
/**
|
||||
* Used by the `css()` helper
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $url Relative or absolute URL
|
||||
* @param string|array $options An array of attributes for the link tag or a media attribute string
|
||||
*/
|
||||
@@ -33,8 +29,8 @@ return [
|
||||
/**
|
||||
* Modify URLs for file objects
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param Kirby\Cms\File $file The original file object
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\File $file The original file object
|
||||
* @return string
|
||||
*/
|
||||
'file::url' => function (App $kirby, File $file): string {
|
||||
@@ -44,10 +40,10 @@ return [
|
||||
/**
|
||||
* Adapt file characteristics
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param Kirby\Cms\File|Kirby\Cms\FileModifications $file The file object
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\File|\Kirby\Cms\FileModifications $file The file object
|
||||
* @param array $options All thumb options (width, height, crop, blur, grayscale)
|
||||
* @return Kirby\Cms\File|Kirby\Cms\FileVersion
|
||||
* @return \Kirby\Cms\File|\Kirby\Cms\FileVersion
|
||||
*/
|
||||
'file::version' => function (App $kirby, $file, array $options = []) {
|
||||
if ($file->isResizable() === false) {
|
||||
@@ -82,7 +78,7 @@ return [
|
||||
/**
|
||||
* Used by the `js()` helper
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $url Relative or absolute URL
|
||||
* @param string|array $options An array of attributes for the link tag or a media attribute string
|
||||
*/
|
||||
@@ -93,7 +89,7 @@ return [
|
||||
/**
|
||||
* Add your own Markdown parser
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $text Text to parse
|
||||
* @param array $options Markdown options
|
||||
* @param bool $inline Whether to wrap the text in `<p>` tags
|
||||
@@ -116,7 +112,7 @@ return [
|
||||
/**
|
||||
* Add your own SmartyPants parser
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $text Text to parse
|
||||
* @param array $options SmartyPants options
|
||||
* @return string
|
||||
@@ -138,7 +134,7 @@ return [
|
||||
/**
|
||||
* Add your own snippet loader
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string|array $name Snippet name
|
||||
* @param array $data Data array for the snippet
|
||||
* @return string|null
|
||||
@@ -165,11 +161,11 @@ return [
|
||||
/**
|
||||
* Add your own template engine
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $name Template name
|
||||
* @param string $type Extension type
|
||||
* @param string $defaultType Default extension type
|
||||
* @return Kirby\Cms\Template
|
||||
* @return \Kirby\Cms\Template
|
||||
*/
|
||||
'template' => function (App $kirby, string $name, string $type = 'html', string $defaultType = 'html') {
|
||||
return new Template($name, $type, $defaultType);
|
||||
@@ -178,7 +174,7 @@ return [
|
||||
/**
|
||||
* Add your own thumb generator
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $src The root of the original file
|
||||
* @param string $dst The root to the desired destination
|
||||
* @param array $options All thumb options that should be applied: `width`, `height`, `crop`, `blur`, `grayscale`
|
||||
@@ -198,7 +194,7 @@ return [
|
||||
/**
|
||||
* Modify all URLs
|
||||
*
|
||||
* @param Kirby\Cms\App $kirby Kirby instance
|
||||
* @param \Kirby\Cms\App $kirby Kirby instance
|
||||
* @param string $path URL path
|
||||
* @param array|null $options Array of options for the Uri class
|
||||
* @param Closure $originalHandler Callback function to the original URL handler with `$path` and `$options` as parameters
|
||||
|
||||
@@ -21,7 +21,7 @@ return [
|
||||
/**
|
||||
* Changes the calendar icon to something custom
|
||||
*/
|
||||
'icon' => function (string $icon = "calendar") {
|
||||
'icon' => function (string $icon = 'calendar') {
|
||||
return $icon;
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'extends' => 'text',
|
||||
'props' => [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Data\Yaml;
|
||||
use Kirby\Toolkit\A;
|
||||
|
||||
return [
|
||||
@@ -112,7 +113,7 @@ return [
|
||||
$field = $this->field();
|
||||
$uploads = $field->uploads();
|
||||
|
||||
return $field->upload($this, $uploads, function ($file) use ($field) {
|
||||
return $field->upload($this, $uploads, function ($file, $parent) use ($field) {
|
||||
return $file->panelPickerData([
|
||||
'image' => $field->image(),
|
||||
'info' => $field->info(),
|
||||
|
||||
@@ -13,13 +13,10 @@ return [
|
||||
],
|
||||
'computed' => [
|
||||
'text' => function () {
|
||||
$text = $this->text;
|
||||
|
||||
if ($model = $this->model()) {
|
||||
if ($text = $this->text) {
|
||||
$text = $this->model()->toString($text);
|
||||
return kirbytext($text);
|
||||
}
|
||||
|
||||
return kirbytext($text);
|
||||
}
|
||||
],
|
||||
'save' => false,
|
||||
|
||||
@@ -19,7 +19,7 @@ return [
|
||||
$self = [
|
||||
'id' => $parent->id() == '' ? null : $parent->id(),
|
||||
'title' => $parent->title()->value(),
|
||||
'parent' => is_a($parent->parent(), Page::class) === true ? $parent->parent()->id() : null,
|
||||
'parent' => is_a($parent->parent(), 'Kirby\Cms\Page') === true ? $parent->parent()->id() : null,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Kirby\Cms\Api;
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Exception\Exception;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
@@ -64,7 +65,7 @@ return [
|
||||
throw new Exception('The file could not be uploaded');
|
||||
}
|
||||
|
||||
return $map($file);
|
||||
return $map($file, $parent);
|
||||
});
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Data\Yaml;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'mixins' => ['min', 'pagepicker', 'picker'],
|
||||
@@ -47,6 +47,12 @@ return [
|
||||
return $this->toPages($value);
|
||||
},
|
||||
],
|
||||
'computed' => [
|
||||
/**
|
||||
* Unset inherited computed
|
||||
*/
|
||||
'default' => null
|
||||
],
|
||||
'methods' => [
|
||||
'pageResponse' => function ($page) {
|
||||
return $page->panelPickerData([
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\Form;
|
||||
use Kirby\Cms\Blueprint;
|
||||
use Kirby\Data\Yaml;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'mixins' => ['min'],
|
||||
@@ -162,7 +163,7 @@ return [
|
||||
$data = [];
|
||||
|
||||
foreach ($value as $row) {
|
||||
$data[] = $this->form($row)->data(true);
|
||||
$data[] = $this->form($row)->data();
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\V;
|
||||
|
||||
return [
|
||||
'mixins' => ['min', 'options'],
|
||||
'props' => [
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
return [
|
||||
@@ -98,6 +97,7 @@ return [
|
||||
],
|
||||
'validations' => [
|
||||
'minlength',
|
||||
'maxlength'
|
||||
'maxlength',
|
||||
'pattern'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -76,7 +76,7 @@ return [
|
||||
/**
|
||||
* If `false`, spellcheck will be switched off
|
||||
*/
|
||||
'spellcheck' => function (bool $spellcheck = false) {
|
||||
'spellcheck' => function (bool $spellcheck = true) {
|
||||
return $spellcheck;
|
||||
},
|
||||
|
||||
@@ -95,10 +95,15 @@ return [
|
||||
[
|
||||
'pattern' => 'upload',
|
||||
'action' => function () {
|
||||
return $this->field()->upload($this, $this->field()->uploads(), function ($file) {
|
||||
$field = $this->field();
|
||||
$uploads = $field->uploads();
|
||||
|
||||
return $this->field()->upload($this, $uploads, function ($file, $parent) use ($field) {
|
||||
$absolute = $field->model()->is($parent) === false;
|
||||
|
||||
return [
|
||||
'filename' => $file->filename(),
|
||||
'dragText' => $file->dragText(),
|
||||
'dragText' => $file->dragText('auto', $absolute),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
@@ -12,8 +13,8 @@ return [
|
||||
/**
|
||||
* Default value which will be saved when a new page/user/file is created
|
||||
*/
|
||||
'default' => function ($value = null) {
|
||||
return $this->toBool($value);
|
||||
'default' => function ($default = null) {
|
||||
return $this->default = $default;
|
||||
},
|
||||
/**
|
||||
* 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.
|
||||
@@ -35,6 +36,9 @@ return [
|
||||
},
|
||||
],
|
||||
'computed' => [
|
||||
'default' => function () {
|
||||
return $this->toBool($this->default);
|
||||
},
|
||||
'value' => function () {
|
||||
if ($this->props['value'] === null) {
|
||||
return $this->default();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'extends' => 'text',
|
||||
'props' => [
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Data\Yaml;
|
||||
use Kirby\Toolkit\A;
|
||||
|
||||
return [
|
||||
'mixins' => ['min', 'picker', 'userpicker'],
|
||||
'props' => [
|
||||
@@ -33,6 +36,12 @@ return [
|
||||
return $this->toUsers($value);
|
||||
},
|
||||
],
|
||||
'computed' => [
|
||||
/**
|
||||
* Unset inherited computed
|
||||
*/
|
||||
'default' => null
|
||||
],
|
||||
'methods' => [
|
||||
'userResponse' => function ($user) {
|
||||
return $user->panelPickerData([
|
||||
|
||||
@@ -5,18 +5,18 @@ use Kirby\Cms\Asset;
|
||||
use Kirby\Cms\Html;
|
||||
use Kirby\Cms\Response;
|
||||
use Kirby\Cms\Url;
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Http\Server;
|
||||
use Kirby\Toolkit\Escape;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\I18n;
|
||||
use Kirby\Toolkit\View;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\V;
|
||||
|
||||
/**
|
||||
* Helper to create an asset object
|
||||
*
|
||||
* @param string $path
|
||||
* @return Kirby\Cms\Asset
|
||||
* @return \Kirby\Cms\Asset
|
||||
*/
|
||||
function asset(string $path)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ function attr(array $attr = null, $before = null, $after = null)
|
||||
* Returns the result of a collection by name
|
||||
*
|
||||
* @param string $name
|
||||
* @return Kirby\Cms\Collection|null
|
||||
* @return \Kirby\Cms\Collection|null
|
||||
*/
|
||||
function collection(string $name)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ function go(string $url = null, int $code = 302)
|
||||
/**
|
||||
* Shortcut for html()
|
||||
*
|
||||
* @param string $text unencoded text
|
||||
* @param string $string unencoded text
|
||||
* @param bool $keepTags
|
||||
* @return string
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ function h(string $string = null, bool $keepTags = false)
|
||||
/**
|
||||
* Creates safe html by encoding special characters
|
||||
*
|
||||
* @param string $text unencoded text
|
||||
* @param string $string unencoded text
|
||||
* @param bool $keepTags
|
||||
* @return string
|
||||
*/
|
||||
@@ -246,7 +246,7 @@ function html(string $string = null, bool $keepTags = false)
|
||||
* <?= image('some/page/myimage.jpg') ?>
|
||||
*
|
||||
* @param string $path
|
||||
* @return Kirby\Cms\File|null
|
||||
* @return \Kirby\Cms\File|null
|
||||
*/
|
||||
function image(string $path = null)
|
||||
{
|
||||
@@ -346,7 +346,7 @@ function invalid(array $data = [], array $rules = [], array $messages = [])
|
||||
/**
|
||||
* Creates a script tag to load a javascript file
|
||||
*
|
||||
* @param string|array $src
|
||||
* @param string|array $url
|
||||
* @param string|array $options
|
||||
* @return void
|
||||
*/
|
||||
@@ -382,7 +382,7 @@ function js($url, $options = null)
|
||||
/**
|
||||
* Returns the Kirby object in any situation
|
||||
*
|
||||
* @return Kirby\Cms\App
|
||||
* @return \Kirby\Cms\App
|
||||
*/
|
||||
function kirby()
|
||||
{
|
||||
@@ -527,7 +527,7 @@ function option(string $key, $default = null)
|
||||
* id or the current page when no id is specified
|
||||
*
|
||||
* @param string|array ...$id
|
||||
* @return Kirby\Cms\Page|null
|
||||
* @return \Kirby\Cms\Page|null
|
||||
*/
|
||||
function page(...$id)
|
||||
{
|
||||
@@ -542,7 +542,7 @@ function page(...$id)
|
||||
* Helper to build page collections
|
||||
*
|
||||
* @param string|array ...$id
|
||||
* @return Kirby\Cms\Pages
|
||||
* @return \Kirby\Cms\Pages
|
||||
*/
|
||||
function pages(...$id)
|
||||
{
|
||||
@@ -616,7 +616,7 @@ function timestamp(string $date = null, int $step = null): ?string
|
||||
/**
|
||||
* Returns the currrent site object
|
||||
*
|
||||
* @return Kirby\Cms\Site
|
||||
* @return \Kirby\Cms\Site
|
||||
*/
|
||||
function site()
|
||||
{
|
||||
|
||||
@@ -5,11 +5,13 @@ use Kirby\Cms\Field;
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Cms\Files;
|
||||
use Kirby\Cms\Html;
|
||||
use Kirby\Cms\Structure;
|
||||
use Kirby\Cms\Page;
|
||||
use Kirby\Cms\Structure;
|
||||
use Kirby\Cms\Url;
|
||||
use Kirby\Data\Json;
|
||||
use Kirby\Data\Yaml;
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\V;
|
||||
use Kirby\Toolkit\Xml;
|
||||
@@ -25,7 +27,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field value into a proper boolean and inverts it
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return boolean
|
||||
*/
|
||||
'isFalse' => function (Field $field): bool {
|
||||
@@ -35,7 +37,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field value into a proper boolean
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return boolean
|
||||
*/
|
||||
'isTrue' => function (Field $field): bool {
|
||||
@@ -46,7 +48,7 @@ return function (App $app) {
|
||||
* Validates the field content with the given validator and parameters
|
||||
*
|
||||
* @param string $validator
|
||||
* @param mixed[] ...$arguments A list of optional validator arguments
|
||||
* @param mixed ...$arguments A list of optional validator arguments
|
||||
* @return boolean
|
||||
*/
|
||||
'isValid' => function (Field $field, string $validator, ...$arguments): bool {
|
||||
@@ -58,7 +60,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Parses the field value with the given method
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string $method [',', 'yaml', 'json']
|
||||
* @return array
|
||||
*/
|
||||
@@ -76,7 +78,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field value into a proper boolean
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param bool $default Default value if the field is empty
|
||||
* @return bool
|
||||
*/
|
||||
@@ -88,7 +90,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field value to a timestamp or a formatted date
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string|null $format PHP date formatting string
|
||||
* @param string|null $fallback Fallback string for `strtotime` (since 3.2)
|
||||
* @return string|int
|
||||
@@ -110,8 +112,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Returns a file object from a filename in the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\File|null
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\File|null
|
||||
*/
|
||||
'toFile' => function (Field $field) {
|
||||
return $field->toFiles()->first();
|
||||
@@ -120,9 +122,9 @@ return function (App $app) {
|
||||
/**
|
||||
* Returns a file collection from a yaml list of filenames in the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string $separator
|
||||
* @return Kirby\Cms\Files
|
||||
* @return \Kirby\Cms\Files
|
||||
*/
|
||||
'toFiles' => function (Field $field, string $separator = 'yaml') {
|
||||
$parent = $field->parent();
|
||||
@@ -140,31 +142,31 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field value into a proper float
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param float $default Default value if the field is empty
|
||||
* @return float
|
||||
*/
|
||||
'toFloat' => function (Field $field, float $default = 0) {
|
||||
$value = $field->isEmpty() ? $default : $field->value;
|
||||
return floatval($value);
|
||||
return (float)$value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the field value into a proper integer
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param int $default Default value if the field is empty
|
||||
* @return int
|
||||
*/
|
||||
'toInt' => function (Field $field, int $default = 0) {
|
||||
$value = $field->isEmpty() ? $default : $field->value;
|
||||
return intval($value);
|
||||
return (int)$value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Wraps a link tag around the field value. The field value is used as the link text
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param mixed $attr1 Can be an optional Url. If no Url is set, the Url of the Page, File or Site will be used. Can also be an array of link attributes
|
||||
* @param mixed $attr2 If `$attr1` is used to set the Url, you can use `$attr2` to pass an array of additional attributes.
|
||||
* @return string
|
||||
@@ -188,8 +190,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Returns a page object from a page id in the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Page|null
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Page|null
|
||||
*/
|
||||
'toPage' => function (Field $field) use ($app) {
|
||||
return $field->toPages()->first();
|
||||
@@ -198,9 +200,9 @@ return function (App $app) {
|
||||
/**
|
||||
* Returns a pages collection from a yaml list of page ids in the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string $separator Can be any other separator to split the field value by
|
||||
* @return Kirby\Cms\Pages
|
||||
* @return \Kirby\Cms\Pages
|
||||
*/
|
||||
'toPages' => function (Field $field, string $separator = 'yaml') use ($app) {
|
||||
return $app->site()->find(false, false, ...$field->toData($separator));
|
||||
@@ -209,17 +211,27 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts a yaml field to a Structure object
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Structure
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Structure
|
||||
*/
|
||||
'toStructure' => function (Field $field) {
|
||||
return new Structure(Yaml::decode($field->value), $field->parent());
|
||||
try {
|
||||
return new Structure(Yaml::decode($field->value), $field->parent());
|
||||
} catch (Exception $e) {
|
||||
if ($field->parent() === null) {
|
||||
$message = 'Invalid structure data for "' . $field->key() . '" field';
|
||||
} else {
|
||||
$message = 'Invalid structure data for "' . $field->key() . '" field on parent "' . $field->parent()->title() . '"';
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException($message);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the field value to a Unix timestamp
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return int
|
||||
*/
|
||||
'toTimestamp' => function (Field $field): int {
|
||||
@@ -229,7 +241,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Turns the field value into an absolute Url
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return string
|
||||
*/
|
||||
'toUrl' => function (Field $field): string {
|
||||
@@ -239,8 +251,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts a user email address to a user object
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\User|null
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\User|null
|
||||
*/
|
||||
'toUser' => function (Field $field) use ($app) {
|
||||
return $field->toUsers()->first();
|
||||
@@ -249,9 +261,9 @@ return function (App $app) {
|
||||
/**
|
||||
* Returns a users collection from a yaml list of user email addresses in the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string $separator
|
||||
* @return Kirby\Cms\Users
|
||||
* @return \Kirby\Cms\Users
|
||||
*/
|
||||
'toUsers' => function (Field $field, string $separator = 'yaml') use ($app) {
|
||||
return $app->users()->find(false, false, ...$field->toData($separator));
|
||||
@@ -279,7 +291,7 @@ return function (App $app) {
|
||||
* Escapes the field value to be safely used in HTML
|
||||
* templates without the risk of XSS attacks
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param string $context html, attr, js or css
|
||||
*/
|
||||
'escape' => function (Field $field, string $context = 'html') {
|
||||
@@ -291,11 +303,11 @@ return function (App $app) {
|
||||
* Creates an excerpt of the field value without html
|
||||
* or any other formatting.
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param int $cahrs
|
||||
* @param boolean $strip
|
||||
* @param string $rep
|
||||
* @return Kirby\Cms\Field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'excerpt' => function (Field $field, int $chars = 0, bool $strip = true, string $rep = '…') {
|
||||
$field->value = Str::excerpt($field->kirbytext()->value(), $chars, $strip, $rep);
|
||||
@@ -305,8 +317,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content to valid HTML
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'html' => function (Field $field) {
|
||||
$field->value = htmlentities($field->value, ENT_COMPAT, 'utf-8');
|
||||
@@ -316,8 +328,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content from Markdown/Kirbytext to valid HTML
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'kirbytext' => function (Field $field) use ($app) {
|
||||
$field->value = $app->kirbytext($field->value, [
|
||||
@@ -333,8 +345,8 @@ return function (App $app) {
|
||||
* to valid HTML
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'kirbytextinline' => function (Field $field) use ($app) {
|
||||
$field->value = $app->kirbytext($field->value, [
|
||||
@@ -348,8 +360,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Parses all KirbyTags without also parsing Markdown
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'kirbytags' => function (Field $field) use ($app) {
|
||||
$field->value = $app->kirbytags($field->value, [
|
||||
@@ -363,8 +375,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content to lowercase
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'lower' => function (Field $field) {
|
||||
$field->value = Str::lower($field->value);
|
||||
@@ -374,8 +386,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts markdown to valid HTML
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'markdown' => function (Field $field) use ($app) {
|
||||
$field->value = $app->markdown($field->value);
|
||||
@@ -385,8 +397,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content to valid XML
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\Cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'xml' => function (Field $field) {
|
||||
$field->value = Xml::encode($field->value);
|
||||
@@ -397,10 +409,10 @@ return function (App $app) {
|
||||
* Cuts the string after the given length and
|
||||
* adds "…" if it is longer
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @param int $length The number of characters in the string
|
||||
* @param string $appendix An optional replacement for the missing rest
|
||||
* @return Kirby\Cms\Field
|
||||
* @return \Kirby\Cms\Field
|
||||
*/
|
||||
'short' => function (Field $field, int $length, string $appendix = '…') {
|
||||
$field->value = Str::short($field->value, $length, $appendix);
|
||||
@@ -410,8 +422,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content to a slug
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\cms\Field
|
||||
*/
|
||||
'slug' => function (Field $field) {
|
||||
$field->value = Str::slug($field->value);
|
||||
@@ -421,8 +433,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Applies SmartyPants to the field
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\cms\Field
|
||||
*/
|
||||
'smartypants' => function (Field $field) use ($app) {
|
||||
$field->value = $app->smartypants($field->value);
|
||||
@@ -432,8 +444,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Splits the field content into an array
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\cms\Field
|
||||
*/
|
||||
'split' => function (Field $field, $separator = ',') {
|
||||
return Str::split((string)$field->value, $separator);
|
||||
@@ -442,8 +454,8 @@ return function (App $app) {
|
||||
/**
|
||||
* Converts the field content to uppercase
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\cms\Field
|
||||
*/
|
||||
'upper' => function (Field $field) {
|
||||
$field->value = Str::upper($field->value);
|
||||
@@ -454,8 +466,8 @@ return function (App $app) {
|
||||
* Avoids typographical widows in strings by replacing
|
||||
* the last space with ` `
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @return Kirby\cms\Field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return \Kirby\cms\Field
|
||||
*/
|
||||
'widont' => function (Field $field) {
|
||||
$field->value = Str::widont($field->value);
|
||||
@@ -467,7 +479,7 @@ return function (App $app) {
|
||||
/**
|
||||
* Parses yaml in the field content and returns an array
|
||||
*
|
||||
* @param Kirby\Cms\Field $field
|
||||
* @param \Kirby\Cms\Field $field
|
||||
* @return array
|
||||
*/
|
||||
'yaml' => function (Field $field): array {
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Api\Api;
|
||||
use Kirby\Cms\App;
|
||||
use Kirby\Cms\Media;
|
||||
use Kirby\Cms\Panel;
|
||||
use Kirby\Cms\PanelPlugins;
|
||||
use Kirby\Cms\PluginAssets;
|
||||
use Kirby\Cms\Response;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Http\Response\Redirect;
|
||||
use Kirby\Http\Router;
|
||||
use Kirby\Http\Router\Route;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\View;
|
||||
|
||||
return function ($kirby) {
|
||||
$api = $kirby->option('api.slug', 'api');
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\File;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'mixins' => [
|
||||
@@ -72,9 +71,6 @@ return [
|
||||
|
||||
return null;
|
||||
},
|
||||
'dragTextType' => function () {
|
||||
return (option('panel')['kirbytext'] ?? true) ? 'kirbytext' : 'markdown';
|
||||
},
|
||||
'parent' => function () {
|
||||
return $this->parentModel();
|
||||
},
|
||||
@@ -84,7 +80,7 @@ return [
|
||||
if ($this->sortBy) {
|
||||
$files = $files->sortBy(...$files::sortArgs($this->sortBy));
|
||||
} elseif ($this->sortable === true) {
|
||||
$files = $files->sortBy('sort', 'asc');
|
||||
$files = $files->sortBy('sort', 'asc', 'filename', 'asc');
|
||||
}
|
||||
|
||||
// apply the default pagination
|
||||
@@ -106,7 +102,7 @@ return [
|
||||
$image = $file->panelImage($this->image);
|
||||
|
||||
$data[] = [
|
||||
'dragText' => $file->dragText($this->dragTextType, $dragTextAbsolute),
|
||||
'dragText' => $file->dragText('auto', $dragTextAbsolute),
|
||||
'filename' => $file->filename(),
|
||||
'id' => $file->id(),
|
||||
'text' => $file->toString($this->text),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
/**
|
||||
@@ -8,5 +10,12 @@ return [
|
||||
'empty' => function ($empty = null) {
|
||||
return I18n::translate($empty, $empty);
|
||||
}
|
||||
],
|
||||
'computed' => [
|
||||
'empty' => function () {
|
||||
if ($this->empty) {
|
||||
return $this->model()->toString($this->empty);
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
@@ -13,7 +13,11 @@ return [
|
||||
],
|
||||
'computed' => [
|
||||
'headline' => function () {
|
||||
return $this->headline ?? ucfirst($this->name);
|
||||
if ($this->headline) {
|
||||
return $this->model()->toString($this->headline);
|
||||
}
|
||||
|
||||
return ucfirst($this->name);
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
@@ -10,5 +10,12 @@ return [
|
||||
'help' => function ($help = null) {
|
||||
return I18n::translate($help, $help);
|
||||
}
|
||||
],
|
||||
'computed' => [
|
||||
'help' => function () {
|
||||
if ($this->help) {
|
||||
return $this->model()->toString($this->help);
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Exception\Exception;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
@@ -22,6 +22,15 @@ return [
|
||||
if (!$parent) {
|
||||
throw new Exception('The parent for the query "' . $query . '" cannot be found in the section "' . $this->name() . '"');
|
||||
}
|
||||
|
||||
if (
|
||||
is_a($parent, 'Kirby\Cms\Page') === false &&
|
||||
is_a($parent, 'Kirby\Cms\Site') === false &&
|
||||
is_a($parent, 'Kirby\Cms\File') === false &&
|
||||
is_a($parent, 'Kirby\Cms\User') === false
|
||||
) {
|
||||
throw new Exception('The parent for the section "' . $this->name() . '" has to be a page, site or user object');
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent === null) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use Kirby\Cms\Blueprint;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\I18n;
|
||||
|
||||
return [
|
||||
'mixins' => [
|
||||
@@ -80,9 +80,6 @@ return [
|
||||
}
|
||||
],
|
||||
'computed' => [
|
||||
'dragTextType' => function () {
|
||||
return option('panel.kirbytext', true) ? 'kirbytext' : 'markdown';
|
||||
},
|
||||
'parent' => function () {
|
||||
return $this->parentModel();
|
||||
},
|
||||
@@ -145,7 +142,7 @@ return [
|
||||
|
||||
$data[] = [
|
||||
'id' => $item->id(),
|
||||
'dragText' => $item->dragText($this->dragTextType),
|
||||
'dragText' => $item->dragText(),
|
||||
'text' => $item->toString($this->text),
|
||||
'info' => $item->toString($this->info ?? false),
|
||||
'parent' => $item->parentId(),
|
||||
|
||||
@@ -8,7 +8,9 @@ use Kirby\Cms\Url;
|
||||
*/
|
||||
return [
|
||||
|
||||
/* Date */
|
||||
/**
|
||||
* Date
|
||||
*/
|
||||
'date' => [
|
||||
'attr' => [],
|
||||
'html' => function ($tag) {
|
||||
@@ -16,7 +18,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Email */
|
||||
/**
|
||||
* Email
|
||||
*/
|
||||
'email' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
@@ -35,7 +39,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* File */
|
||||
/**
|
||||
* File
|
||||
*/
|
||||
'file' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
@@ -66,7 +72,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Gist */
|
||||
/**
|
||||
* Gist
|
||||
*/
|
||||
'gist' => [
|
||||
'attr' => [
|
||||
'file'
|
||||
@@ -76,7 +84,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Image */
|
||||
/**
|
||||
* Image
|
||||
*/
|
||||
'image' => [
|
||||
'attr' => [
|
||||
'alt',
|
||||
@@ -143,7 +153,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Link */
|
||||
/**
|
||||
* Link
|
||||
*/
|
||||
'link' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
@@ -169,7 +181,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Tel */
|
||||
/**
|
||||
* Tel
|
||||
*/
|
||||
'tel' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
@@ -186,7 +200,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Twitter */
|
||||
/**
|
||||
* Twitter
|
||||
*/
|
||||
'twitter' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
@@ -216,7 +232,9 @@ return [
|
||||
}
|
||||
],
|
||||
|
||||
/* Video */
|
||||
/**
|
||||
* Video
|
||||
*/
|
||||
'video' => [
|
||||
'attr' => [
|
||||
'class',
|
||||
|
||||
Reference in New Issue
Block a user