Upgrade to 3.6.1
This commit is contained in:
@@ -130,9 +130,10 @@ class Document
|
||||
|
||||
// remove missing files
|
||||
$assets['css'] = array_filter($assets['css']);
|
||||
$assets['js'] = array_filter($assets['js'], function ($js) {
|
||||
return empty($js['src']) === false;
|
||||
});
|
||||
$assets['js'] = array_filter(
|
||||
$assets['js'],
|
||||
fn ($js) => empty($js['src']) === false
|
||||
);
|
||||
|
||||
return $assets;
|
||||
}
|
||||
|
@@ -316,7 +316,7 @@ class File extends Model
|
||||
$absolute = $parent !== $params['model'];
|
||||
}
|
||||
|
||||
$params['text'] = $params['text'] ?? '{{ file.filename }}';
|
||||
$params['text'] ??= '{{ file.filename }}';
|
||||
|
||||
return array_merge(parent::pickerData($params), [
|
||||
'filename' => $name,
|
||||
|
@@ -68,7 +68,7 @@ abstract class Json
|
||||
}
|
||||
|
||||
// always inject the response code
|
||||
$data['code'] = $data['code'] ?? 200;
|
||||
$data['code'] ??= 200;
|
||||
$data['path'] = $options['path'] ?? null;
|
||||
$data['referrer'] = Panel::referrer();
|
||||
|
||||
|
@@ -77,7 +77,7 @@ abstract class Model
|
||||
*/
|
||||
public function dragTextType(string $type = null): string
|
||||
{
|
||||
$type = $type ?? 'auto';
|
||||
$type ??= 'auto';
|
||||
|
||||
if ($type === 'auto') {
|
||||
$type = option('panel.kirbytext', true) ? 'kirbytext' : 'markdown';
|
||||
@@ -141,8 +141,8 @@ abstract class Model
|
||||
// main url
|
||||
$settings['url'] = $image->url();
|
||||
|
||||
// only create srcsets for actual File objects
|
||||
if (is_a($image, 'Kirby\Cms\File') === true) {
|
||||
// only create srcsets for resizable files
|
||||
if ($image->isResizable() === true) {
|
||||
$settings['src'] = static::imagePlaceholder();
|
||||
|
||||
switch ($layout) {
|
||||
@@ -174,6 +174,8 @@ abstract class Model
|
||||
]
|
||||
]);
|
||||
}
|
||||
} elseif ($image->isViewable() === true) {
|
||||
$settings['src'] = $image->url();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -231,7 +231,7 @@ class Page extends Model
|
||||
*/
|
||||
public function pickerData(array $params = []): array
|
||||
{
|
||||
$params['text'] = $params['text'] ?? '{{ page.title }}';
|
||||
$params['text'] ??= '{{ page.title }}';
|
||||
|
||||
return array_merge(parent::pickerData($params), [
|
||||
'dragText' => $this->dragText(),
|
||||
|
@@ -36,14 +36,14 @@ class Panel
|
||||
*/
|
||||
public static function area(string $id, $area): array
|
||||
{
|
||||
$area['id'] = $id;
|
||||
$area['label'] = $area['label'] ?? $id;
|
||||
$area['breadcrumb'] = $area['breadcrumb'] ?? [];
|
||||
$area['breadcrumbLabel'] = $area['breadcrumbLabel'] ?? $area['label'];
|
||||
$area['title'] = $area['label'];
|
||||
$area['menu'] = $area['menu'] ?? false;
|
||||
$area['link'] = $area['link'] ?? $id;
|
||||
$area['search'] = $area['search'] ?? null;
|
||||
$area['id'] = $id;
|
||||
$area['label'] ??= $id;
|
||||
$area['breadcrumb'] ??= [];
|
||||
$area['breadcrumbLabel'] ??= $area['label'];
|
||||
$area['title'] = $area['label'];
|
||||
$area['menu'] ??= false;
|
||||
$area['link'] ??= $id;
|
||||
$area['search'] ??= null;
|
||||
|
||||
return $area;
|
||||
}
|
||||
@@ -229,11 +229,14 @@ class Panel
|
||||
/**
|
||||
* Returns the referrer path if present
|
||||
*
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
public static function referrer(): ?string
|
||||
public static function referrer(): string
|
||||
{
|
||||
$referrer = kirby()->request()->header('X-Fiber-Referrer') ?? get('_referrer');
|
||||
$referrer = kirby()->request()->header('X-Fiber-Referrer')
|
||||
?? get('_referrer')
|
||||
?? '';
|
||||
|
||||
return '/' . trim($referrer, '/');
|
||||
}
|
||||
|
||||
@@ -302,9 +305,6 @@ class Panel
|
||||
// create a micro-router for the Panel
|
||||
return router($path, $method = $kirby->request()->method(), $routes, function ($route) use ($areas, $kirby, $method, $path) {
|
||||
|
||||
// trigger hook
|
||||
$route = $kirby->apply('panel.route:before', compact('route', 'path', 'method'), 'route');
|
||||
|
||||
// route needs authentication?
|
||||
$auth = $route->attributes()['auth'] ?? true;
|
||||
$areaId = $route->attributes()['area'] ?? null;
|
||||
@@ -313,6 +313,9 @@ class Panel
|
||||
|
||||
// call the route action to check the result
|
||||
try {
|
||||
// trigger hook
|
||||
$route = $kirby->apply('panel.route:before', compact('route', 'path', 'method'), 'route');
|
||||
|
||||
// check for access before executing area routes
|
||||
if ($auth !== false) {
|
||||
static::firewall($kirby->user(), $areaId);
|
||||
@@ -450,6 +453,15 @@ class Panel
|
||||
$routes = [];
|
||||
|
||||
foreach ($dropdowns as $name => $dropdown) {
|
||||
// Handle shortcuts for dropdowns. The name is the pattern
|
||||
// and options are defined in a Closure
|
||||
if (is_a($dropdown, 'Closure') === true) {
|
||||
$dropdown = [
|
||||
'pattern' => $name,
|
||||
'action' => $dropdown
|
||||
];
|
||||
}
|
||||
|
||||
// create the full pattern with dropdowns prefix
|
||||
$pattern = 'dropdowns/' . trim(($dropdown['pattern'] ?? $name), '/');
|
||||
|
||||
|
@@ -172,7 +172,7 @@ class User extends Model
|
||||
*/
|
||||
public function pickerData(array $params = null): array
|
||||
{
|
||||
$params['text'] = $params['text'] ?? '{{ user.username }}';
|
||||
$params['text'] ??= '{{ user.username }}';
|
||||
|
||||
return array_merge(parent::pickerData($params), [
|
||||
'email' => $this->model->email(),
|
||||
|
Reference in New Issue
Block a user