diff --git a/config/bolt/contenttypes.yaml b/config/bolt/contenttypes.yaml index 83fc89701..5d0388a21 100644 --- a/config/bolt/contenttypes.yaml +++ b/config/bolt/contenttypes.yaml @@ -133,7 +133,7 @@ entries: image: type: image group: media - upload: entries + upload: "{random}/{contenttype}/{date}" video: type: embed relations: diff --git a/src/Twig/HtmlExtension.php b/src/Twig/HtmlExtension.php index cd342e8c7..3844caced 100644 --- a/src/Twig/HtmlExtension.php +++ b/src/Twig/HtmlExtension.php @@ -108,8 +108,8 @@ public function placeholders(?string $string = null, array $replacements = []): $baseReplacements = [ 'year' => date('Y'), 'month' => date('m'), - 'day' => date('D'), - 'date' => date('Y-m-D'), + 'day' => date('d'), + 'date' => date('Y-m-d'), 'random' => bin2hex(random_bytes(4)), ]; diff --git a/templates/_partials/fields/file.html.twig b/templates/_partials/fields/file.html.twig index d299e3fda..0e005ccec 100644 --- a/templates/_partials/fields/file.html.twig +++ b/templates/_partials/fields/file.html.twig @@ -7,7 +7,7 @@ {% endset %} {% block field %} - {% set setPath = field.definition.get('upload')|placeholders({'random': 4, 'contenttype': record.contenttype}) %} + {% set setPath = field.definition.get('upload')|placeholders({'contenttype': record.contenttype}) %} {% set directory = path('bolt_async_upload', {'location': location|default('files'), 'path': setPath}) %} {% set filelist = path('bolt_async_filelisting', {'location': location|default('files') }) %} {% set labels = { diff --git a/templates/_partials/fields/filelist.html.twig b/templates/_partials/fields/filelist.html.twig index 60be7d4aa..f909c68db 100644 --- a/templates/_partials/fields/filelist.html.twig +++ b/templates/_partials/fields/filelist.html.twig @@ -7,7 +7,7 @@ {% endset %} {% block field %} - {% set setPath = field.definition.get('upload')|placeholders({'random': 4, 'contenttype': record.contenttype}) %} + {% set setPath = field.definition.get('upload')|placeholders({'contenttype': record.contenttype}) %} {% set directory = path('bolt_async_upload', {'location': location|default('files'), 'path': setPath}) %} {% set filelist = path('bolt_async_filelisting', {'location': location|default('files') }) %} {% set labels = { diff --git a/templates/_partials/fields/image.html.twig b/templates/_partials/fields/image.html.twig index 858b483cd..f1587c878 100644 --- a/templates/_partials/fields/image.html.twig +++ b/templates/_partials/fields/image.html.twig @@ -8,7 +8,7 @@ {% block field %} - {% set setPath = field.definition.get('upload')|placeholders({'random': 4, 'contenttype': record.contenttype}) %} + {% set setPath = field.definition.get('upload')|placeholders({'contenttype': record.contenttype}) %} {% set directory = path('bolt_async_upload', {'location': location|default('files'), 'path': setPath}) %} {% set filelist = path('bolt_async_filelisting', {'location': location|default('files'), 'type': 'images' }) %} {% set labels = { diff --git a/templates/_partials/fields/imagelist.html.twig b/templates/_partials/fields/imagelist.html.twig index db3bfdcaf..69c0bcb00 100644 --- a/templates/_partials/fields/imagelist.html.twig +++ b/templates/_partials/fields/imagelist.html.twig @@ -7,7 +7,7 @@ {% endset %} {% block field %} - {% set setPath = field.definition.get('upload')|placeholders({'random': 4, 'contenttype': record.contenttype}) %} + {% set setPath = field.definition.get('upload')|placeholders({'contenttype': record.contenttype}) %} {% set directory = path('bolt_async_upload', {'location': location|default('files'), 'path': setPath}) %} {% set filelist = path('bolt_async_filelisting', {'location': location|default('files'), 'type': 'images' }) %} {% set labels = {