Remove Field API code from FileUploadResource->post() to make it more generic

Created on 13 March 2019, almost 6 years ago
Updated 7 January 2025, 13 days ago

Drupal\file\Plugin\rest\resource\FileUploadResource->post() has a lot of useful file handling code which can be reused. Currently it's tied to the Field API with lines such as $destination = $this->getUploadLocation($field_definition->getSettings());. This prevents its use when not using the field API (e.g. Webform).

While $field_definition->getSettings() is the most obvious, there could be others. Removing this from the post() method means it would be possible to extend the class and only need to override some helper methods, such as getUploadLocation() and validateAndLoadFieldDefinition().

Let me know if I need to provide further information or a specific use case.

📌 Task
Status

Closed: duplicate

Version

8.6 ⚰️

Component

file.module

Created by

🇦🇺Australia imclean Tasmania

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024