I have experimented some to get inline work on preview. I found that function _inline_fileobj() returns an object on view put an array on preview. I don't know enough about the inner working of core to know if this is a bug or how it should work.

By adding the line "$file = (object)$file;" to make sure $file is an object inline now works on preview on my site.

Line 226+ inline.module:

$file = _inline_fileobj($node, $value);
// Convert $file to an object, if necessary.
// This makes inline work on preview
$file = (object)$file;

Comments

sun’s picture

This is already included in this patch, which also adds

  • compatibility support for attachment module
  • improved theming function
  • file type icons based on mime types
sun’s picture

@frjo: Did you check the mentioned patch?

frjo’s picture

Yes I did and I borrowed some code for my own hacked version of the inline.module. It was while updating my own version for 4.7 that I found the object/array problem.

http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/frjo/inline47/

Bèr Kessels’s picture

Title: Making inline work on preview by converting $file from array to object » Making inline work on preview
Version: 4.7.x-1.x-dev » 6.x-2.x-dev
Assigned: Unassigned » Bèr Kessels
Category: feature » bug
Status: Active » Needs review
StatusFileSize
new4.06 KB

This patch makes previews work. (Patch should work against 4.7 too.)

Bèr Kessels’s picture

Status: Needs review » Fixed

Fixed and committed in HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)