Upgrade to 4.3.0
This commit is contained in:
@@ -22,7 +22,7 @@ return [
|
||||
'text' => Escape::html($page->title()->value()),
|
||||
'link' => $page->panel()->url(true),
|
||||
'info' => Escape::html($page->id()),
|
||||
'uuid' => $page->uuid()->toString(),
|
||||
'uuid' => $page->uuid()?->toString(),
|
||||
]),
|
||||
'pagination' => $pages->pagination()->toArray()
|
||||
];
|
||||
|
||||
@@ -85,6 +85,7 @@ return [
|
||||
'props' => [
|
||||
'environment' => $environment,
|
||||
'exceptions' => $kirby->option('debug') === true ? $exceptions : [],
|
||||
'info' => $system->info(),
|
||||
'plugins' => $plugins,
|
||||
'security' => $security,
|
||||
'urls' => [
|
||||
|
||||
@@ -44,7 +44,7 @@ return function ($props) {
|
||||
}
|
||||
|
||||
if (empty($sidebar) === true) {
|
||||
$props['fields'] = $props['fields'] ?? [];
|
||||
$props['fields'] ??= [];
|
||||
|
||||
unset(
|
||||
$props['files'],
|
||||
|
||||
@@ -26,7 +26,7 @@ return function (array $props) {
|
||||
|
||||
// inject the global templates definition
|
||||
if (empty($templates) === false) {
|
||||
$props['templates'] = $props['templates'] ?? $templates;
|
||||
$props['templates'] ??= $templates;
|
||||
}
|
||||
|
||||
return array_replace_recursive($defaults, $props);
|
||||
|
||||
@@ -232,11 +232,39 @@ return [
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_array($this->status, ['draft', 'all']) === false) {
|
||||
if ($this->isFull() === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isFull() === true) {
|
||||
// form here on, we need to check with which status
|
||||
// the pages are created and if the section can show
|
||||
// these newly created pages
|
||||
|
||||
// if the section shows pages no matter what status they have,
|
||||
// we can always show the add button
|
||||
if ($this->status === 'all') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// collect all statuses of the blueprints
|
||||
// that are allowed to be created
|
||||
$statuses = [];
|
||||
|
||||
foreach ($this->blueprintNames() as $blueprint) {
|
||||
try {
|
||||
$props = Blueprint::load('pages/' . $blueprint);
|
||||
$statuses[] = $props['create']['status'] ?? 'draft';
|
||||
} catch (Throwable) {
|
||||
$statuses[] = 'draft'; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
$statuses = array_unique($statuses);
|
||||
|
||||
// if there are multiple statuses or if the section is showing
|
||||
// a different status than new pages would be created with,
|
||||
// we cannot show the add button
|
||||
if (count($statuses) > 1 || $this->status !== $statuses[0]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,22 +277,12 @@ return [
|
||||
'methods' => [
|
||||
'blueprints' => function () {
|
||||
$blueprints = [];
|
||||
$templates = empty($this->create) === false ? A::wrap($this->create) : $this->templates;
|
||||
|
||||
if (empty($templates) === true) {
|
||||
$templates = $this->kirby()->blueprints();
|
||||
}
|
||||
|
||||
// excludes ignored templates
|
||||
if ($templatesIgnore = $this->templatesIgnore) {
|
||||
$templates = array_diff($templates, $templatesIgnore);
|
||||
}
|
||||
|
||||
// convert every template to a usable option array
|
||||
// for the template select box
|
||||
foreach ($templates as $template) {
|
||||
foreach ($this->blueprintNames() as $blueprint) {
|
||||
try {
|
||||
$props = Blueprint::load('pages/' . $template);
|
||||
$props = Blueprint::load('pages/' . $blueprint);
|
||||
|
||||
$blueprints[] = [
|
||||
'name' => basename($props['name']),
|
||||
@@ -272,14 +290,28 @@ return [
|
||||
];
|
||||
} catch (Throwable) {
|
||||
$blueprints[] = [
|
||||
'name' => basename($template),
|
||||
'title' => ucfirst($template),
|
||||
'name' => basename($blueprint),
|
||||
'title' => ucfirst($blueprint),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $blueprints;
|
||||
}
|
||||
},
|
||||
'blueprintNames' => function () {
|
||||
$blueprints = empty($this->create) === false ? A::wrap($this->create) : $this->templates;
|
||||
|
||||
if (empty($blueprints) === true) {
|
||||
$blueprints = $this->kirby()->blueprints();
|
||||
}
|
||||
|
||||
// excludes ignored templates
|
||||
if ($templatesIgnore = $this->templatesIgnore) {
|
||||
$blueprints = array_diff($blueprints, $templatesIgnore);
|
||||
}
|
||||
|
||||
return $blueprints;
|
||||
},
|
||||
],
|
||||
'toArray' => function () {
|
||||
return [
|
||||
|
||||
@@ -252,6 +252,7 @@ return [
|
||||
'caption',
|
||||
'controls',
|
||||
'class',
|
||||
'disablepictureinpicture',
|
||||
'height',
|
||||
'loop',
|
||||
'muted',
|
||||
@@ -294,12 +295,15 @@ return [
|
||||
|
||||
// don't use attributes that iframe doesn't support
|
||||
if ($isProviderVideo === false) {
|
||||
// converts tag attributes to supported formats (listed below) to output correct html
|
||||
// booleans: autoplay, controls, loop, muted
|
||||
// strings : poster, preload
|
||||
// for ex : `autoplay` will not work if `false` is a `string` instead of a `boolean`
|
||||
// convert tag attributes to supported formats (bool, string)
|
||||
// to output correct html attributes
|
||||
//
|
||||
// for ex:
|
||||
// `autoplay` will not work if `false` is a string
|
||||
// instead of a boolean
|
||||
$attrs['autoplay'] = $autoplay = Str::toType($tag->autoplay, 'bool');
|
||||
$attrs['controls'] = Str::toType($tag->controls ?? true, 'bool');
|
||||
$attrs['disablepictureinpicture'] = Str::toType($tag->disablepictureinpicture ?? false, 'bool');
|
||||
$attrs['loop'] = Str::toType($tag->loop, 'bool');
|
||||
$attrs['muted'] = Str::toType($tag->muted ?? $autoplay, 'bool');
|
||||
$attrs['playsinline'] = Str::toType($tag->playsinline ?? $autoplay, 'bool');
|
||||
|
||||
Reference in New Issue
Block a user