Right now we have a set of public API functions in field_file.inc, which is nearly equivalent to hook_file() in Drupal 7. The general File API is quite good, but FileField itself doesn't provide any useful APIs.
Some API functions that would be useful:
- #369560: Get array of files attached to node
- #380200: Get node referencing a file
- Get the file reference count for a particular field
We've already got this last option, but it's not in the FileField name-space: the field_file_references() function. This function shouldn't be FileField specific, since the field_file.inc file is meant to be File API functions and be independent from FileField itself.
This patch makes a place for us to put public API functions in filefield.module, and moves the filefield_file_references()
code to the new location in a new function filefield_get_file_reference_count()
.
Comment | File | Size | Author |
---|---|---|---|
filefield_api_start.patch | 5.13 KB | quicksketch |
Comments
Comment #1
quicksketchAfter checking that all our tests still pass, I committed this version of the patch. This should open the door for the other API functions that people have suggested.