Skip to content

Commit

Permalink
set weather story upload paths (#1886)
Browse files Browse the repository at this point in the history
* weather story: filefield_paths configuration

* weather story: tweak upload settings

* weather story: change initial upload directory

* weather story: add doc about filefield_paths

---------

Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com>
  • Loading branch information
jamestranovich-noaa and eric-gade authored Oct 11, 2024
1 parent 5613f44 commit 01e407e
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 4 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"drupal/core-composer-scaffold": "^10.3",
"drupal/core-project-message": "^10.3",
"drupal/core-recommended": "^10.3",
"drupal/filefield_paths": "^1.0@beta",
"drupal/jsonapi_extras": "^3.25",
"drupal/key_asymmetric": "^1.1",
"drupal/log_stdout": "^1.5",
Expand Down
66 changes: 64 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/dev/contributed-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ _Added August 2024_

We use this module to disable resource access by default, via the API endpoint. We also use this module to disable certain fields within permitted Drupal content types for the API endpoint. Please see [./json-api.md](the JSON:API documentation) for more information.

#### [`filefield_paths`](https://www.drupal.org/project/filefield_paths)

_Added October 2024_

We use this module to group DSS builder uploads under a per-WFO directory structure. This module also has the side benefit of keeping our uploaded files cleanly organized.

## Javascript

Similarly, there are countless Javascript libraries that we can use to simplify the job of building the website. Those are also documented here.
Expand Down
1 change: 1 addition & 0 deletions web/config/sync/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module:
field: 0
field_ui: 0
file: 0
filefield_paths: 0
filter: 0
help: 0
image: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ dependencies:
- field.storage.node.field_fullimage
- node.type.wfo_weather_story_upload
module:
- filefield_paths
- image
third_party_settings:
filefield_paths:
enabled: true
file_path:
value: '[node:field_office]/[node:content-type:machine-name]/field_fullimage'
options:
slashes: true
pathauto: false
transliterate: false
file_name:
value: '[file:ffp-name-only].[file:ffp-extension-original]'
options:
slashes: true
pathauto: false
transliterate: false
redirect: false
retroactive_update: false
active_updating: false
id: node.wfo_weather_story_upload.field_fullimage
field_name: field_fullimage
entity_type: node
Expand All @@ -20,7 +39,7 @@ default_value_callback: ''
settings:
handler: 'default:file'
handler_settings: { }
file_directory: '[date:custom:Y]-[date:custom:m]'
file_directory: 'tmp/[random:number]'
file_extensions: 'png gif jpg jpeg webp'
max_filesize: '2 MB'
max_resolution: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ dependencies:
- field.storage.node.field_smallimage
- node.type.wfo_weather_story_upload
module:
- filefield_paths
- image
third_party_settings:
filefield_paths:
enabled: true
file_path:
value: '[node:field_office]/[node:content-type:machine-name]/field_smallimage'
options:
slashes: true
pathauto: false
transliterate: false
file_name:
value: '[file:ffp-name-only].[file:ffp-extension-original]'
options:
slashes: true
pathauto: false
transliterate: false
redirect: false
retroactive_update: false
active_updating: false
id: node.wfo_weather_story_upload.field_smallimage
field_name: field_smallimage
entity_type: node
Expand All @@ -20,7 +39,7 @@ default_value_callback: ''
settings:
handler: 'default:file'
handler_settings: { }
file_directory: '[date:custom:Y]-[date:custom:m]'
file_directory: 'tmp/[random:number]'
file_extensions: 'png gif jpg jpeg webp'
max_filesize: '2 MB'
max_resolution: ''
Expand Down
3 changes: 3 additions & 0 deletions web/config/sync/filefield_paths.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_core:
default_config_hash: Kt7Ug8VUG1kQuaf77ad_5XIKSr-66nzuWUTIEVmhKl8
temp_location: 'public://filefield_paths'

0 comments on commit 01e407e

Please sign in to comment.