Cover by Sammy Spets

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

File entities

Drupal 7 introduced some rather important changes for files. First and foremost, they became entities, although they are not fully-fledged entities. This is most likely due to how different they are to content. For example, at the time of writing, file entities don't have any write support through wrappers. All changes must be done using the entity object itself or the File API. The latter is the best option, as the File API is quite simple to use. The wrapper save() method still works if you truly wish to bypass the File API.

In your applications, you will more often read values from file entities than you will write them. For reading, we should use wrappers or entity properties. The following table shows the wrapper and entity properties ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required