Skip to content

Commit

Permalink
Merge pull request #1857 from bolt/fix/stupid-mistake-in-default-imag…
Browse files Browse the repository at this point in the history
…e-locations

Fix default locations for image uploads
  • Loading branch information
bobdenotter authored Sep 16, 2020
2 parents f394f2f + 7c618b6 commit b5b7ccb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/bolt/contenttypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ entries:
image:
type: image
group: media
upload: entries
upload: "{random}/{contenttype}/{date}"
video:
type: embed
relations:
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/HtmlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
];

Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/fields/file.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/fields/filelist.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/fields/image.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/fields/imagelist.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit b5b7ccb

Please sign in to comment.