Our field integration omits core field types: file and image.

In the end, the value for these fields is a fid as returned by file_save(). Should not be too complex.

CommentFileSizeAuthor
#3 entity_files.patch27.53 KBfago

Comments

fago’s picture

Category: feature » task

Indeed, there is already basic support for the file entity itself though I didn't test that much yet.

fago’s picture

Component: Metadata integration » Entity Metadata - core integration
Priority: Normal » Major
fago’s picture

Status: Active » Needs review
StatusFileSize
new27.53 KB

I took a stab on that and it turned out being more difficult/complex than necessary. So I had a look at improving the metadata wrappers and simplified the handling of nested data structures, as we have them for fields that are composed of multiple properties (e.g. file + description).

Metadata wrapper changes:
* value() now doesn't throw an exception for not set properties any more, but returns NULL.
* Fixed dealing with arrays as data structures without the necessity of wrapping it into another object.
* Added support to auto-create data structures to ease adding stuff, e.g. you can add a file now just by doing $node->field_file[42]['file'] = $file;.

Attached patch contains the metadata wrapper improvements + implements file field support.

fago’s picture

Status: Needs review » Fixed

I've completed the patch to also add support for image fields + committed it.

fago’s picture

based on the improvements described in #3, I also improved the text-field integration to support summaries as well as text fields with summary without text processing + added tests for that.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.