Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slattery/e303ccf1a0187065cd350c560f759dca to your computer and use it in GitHub Desktop.
Save slattery/e303ccf1a0187065cd350c560f759dca to your computer and use it in GitHub Desktop.
filefield_paths_fix_nothirdpartysettings.patch
--- a/filefield_paths.module 2022-08-08 16:04:37.000000000 -0400
+++ b/filefield_paths.module 2022-08-08 19:23:33.000000000 -0400
@@ -212,11 +212,13 @@
// Force all File (Field) Paths uploads to go to the temporary file system
// prior to being processed.
if (isset($element['#type']) && $element['#type'] == 'managed_file') {
- $settings = $context['items']->getFieldDefinition()
- ->getThirdPartySettings('filefield_paths');
- if (isset($settings['enabled']) && $settings['enabled']) {
- $element['#upload_location'] = \Drupal::config('filefield_paths.settings')
+ $definition = $context['items']->getFieldDefinition();
+ if ($definition instanceof ThirdPartySettingsInterface) {
+ $settings = $definition->getThirdPartySettings('filefield_paths');
+ if (isset($settings['enabled']) && $settings['enabled']) {
+ $element['#upload_location'] = \Drupal::config('filefield_paths.settings')
->get('temp_location');
+ }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment