Replace Kirby hook related to file type with hidden field
This commit is contained in:
parent
03a44a5ec5
commit
6788340d3e
2 changed files with 5 additions and 12 deletions
|
@ -10,3 +10,7 @@ fields:
|
||||||
help:
|
help:
|
||||||
en: "Short description displayed if the image can't be loaded (also used by screen readers)."
|
en: "Short description displayed if the image can't be loaded (also used by screen readers)."
|
||||||
fr: "Courte description affichée si l'image ne peut être chargée (également utilisée par les lecteurs d'écran)."
|
fr: "Courte description affichée si l'image ne peut être chargée (également utilisée par les lecteurs d'écran)."
|
||||||
|
# Hidden field
|
||||||
|
file_type:
|
||||||
|
type: hidden
|
||||||
|
default: "{{ file.type }}"
|
||||||
|
|
|
@ -26,7 +26,7 @@ return [
|
||||||
'link' => 'pages/media-library',
|
'link' => 'pages/media-library',
|
||||||
'current' => function (string $current): bool { // Override default menu entry highlighting
|
'current' => function (string $current): bool { // Override default menu entry highlighting
|
||||||
$path = Kirby\Cms\App::instance()->path();
|
$path = Kirby\Cms\App::instance()->path();
|
||||||
return Str::contains($path, 'pages/media-library');
|
return Str::contains($path, 'pages/media-library'); // Link of current menu entry
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'users',
|
'users',
|
||||||
|
@ -38,17 +38,6 @@ return [
|
||||||
'intro' => false,
|
'intro' => false,
|
||||||
'byLine' => 'Sitemap generated with <a href="https://github.com/kirbyzone/sitemapper" target="_blank">Sitemapper by Kirbyzone</a>.'
|
'byLine' => 'Sitemap generated with <a href="https://github.com/kirbyzone/sitemapper" target="_blank">Sitemapper by Kirbyzone</a>.'
|
||||||
],
|
],
|
||||||
// Hooks
|
|
||||||
'hooks' => [
|
|
||||||
'file.create:after' => function($file) {
|
|
||||||
// Populate file_type field with $file->type() method after file creation
|
|
||||||
if ($file->type()) {
|
|
||||||
$file->update([
|
|
||||||
'file_type' => $file->type()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// Thumbnails and srcsets presets
|
// Thumbnails and srcsets presets
|
||||||
'thumbs' => [
|
'thumbs' => [
|
||||||
'srcsets' => [
|
'srcsets' => [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue