Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
In D7 we have function hook_filefield_paths_field_type_info() to add compatible field types to get File (Field) Paths support. Looks like in D8 we could support all compatible fields out of the box. See patch.
Comments
Comment #2
alexverb CreditAttribution: alexverb as a volunteer commentedJust a two line patch.
Comment #3
alexverb CreditAttribution: alexverb as a volunteer commentedComment #4
Deciphered CreditAttribution: Deciphered at Realityloop commentedPatch looks good, and is exactly what my intent was, just badly executed as it was some of my first D8 work. Will do a manual test (as automated tests are still not currently passing).
Comment #5
Deciphered CreditAttribution: Deciphered at Realityloop commentedAutomated tests fail (on an environment where they normally pass):
Issue is related to the
new $class
section, as it evidently expects arguments.Comment #6
Deciphered CreditAttribution: Deciphered at Realityloop commentedYou can see the TravisCI results at https://travis-ci.org/Decipher/filefield_paths/builds/113510481.
Comment #7
Deciphered CreditAttribution: Deciphered at Realityloop commentedSimple fix:
if (class_exists($class) && new $class($field->getItemDefinition()) instanceof FileFieldItemList) {
Comment #9
Deciphered CreditAttribution: Deciphered at Realityloop commentedComment #10
alexverb CreditAttribution: alexverb as a volunteer commentedJust want to let you know you'd probably want to remove hook_filefield_paths_field_type_info() reference in filefield_paths.api.php.
Comment #11
Deciphered CreditAttribution: Deciphered at Realityloop commentedYup, there's absolutely cleanup stuff that needs to be done still. Will open that as a new issue.
Comment #13
geek-merlinJust a note: This works for all types that extend FileFieldItemList, but not if they decorate it.
Fixing this is only possible if core adds a FileFieldItemListInterface.