When creating a field collection with a wysiwyg image field and a long text (with ckeditor) field in the field collections, its not possible to upload an image, looks like the module try to get the image preview format from the parent entity (the node), and not from the field collection entity.

The errors are:
Notice: Undefined index: preview_image_style in image_field_widget_process() (line 381 of /srv/http/sandbox/modules/image/image.field.inc).
and

Warning: end() expects parameter 1 to be array, null given in file_managed_file_validate() (line 574 of /srv/http/sandbox/modules/file/file.module).

in the location: http://sandbox.dev/token_replace/ajax/[node:field_image-formatted:0:imag...

To make it clear.
My content type is just the title and a embedded field collection. The field collection is a long text (with ckeditor), and a image field using the wysiwyg widget.

Expanding in this issue, as stated before, if the image wysiwyg field is in the node, and the long text is in the field collection, and the field collection is embedded, it is possible to upload an image (probably because it founds the preview image) but you can't see the image in the long text field at the node view page.

Comments

Deciphered’s picture

Title: Wysiwyg field image doesn't works with embedded field collection » Wysiwyg Fields in embedded entity forms (Field collections, Paragrpahs, etc)

So this issue isn't restricted to Field collections, it also happens with Paragraphs and presumably other complex Entity based fields.

I have pushed three improvements related to this issue, two to Wysiwyg Fields and one Token replace AJAX.

There are two outstanding issues that I am aware of:

  1. Token replace AJAX needs to know which embedded entity it is using as Context for token_replace(); this is to ensure the token is replaced in Wysiwyg mode.
  2. When two embedded entities exist, each with there own version of the Wysiwyg field, the plugins need to know which field they are dealing with.

Once the 1st one of these issues work, you will be able to use Wysiwyg Fields on a field inside of a Field collection in the case that you only have a single instance of that field collection, which is a start. As a workaround, you can disable a couple of lines of Javascript which deal with removing the Wysiwyg field CKEditor widget if the token is not able to be replaced by Token replace AJAX, which proves that it does partially work already. Those lines are #168-171 of wysiwyg_fields/plugins/ckeditor/plugin.js

azinck’s picture

Title: Wysiwyg Fields in embedded entity forms (Field collections, Paragrpahs, etc) » Wysiwyg Fields in embedded entity forms (Field collections, Paragraphs, etc)
garbo’s picture

Personally, I also have this error:

Warning: end() expects parameter 1 to be array, null given in file_managed_file_validate() (line 574 of /../modules/file/file.module).

It only happens when the WYSIWYG_FIELDS-content is being shown inside the CKEditor. So not on node-view pages for instance.

The WYSIWYG_FIELDS-content is being shown without problems so the users and site-admins don't notice any problems.

Commenting out lines 168-171 of wysiwyg_fields/plugins/ckeditor/plugin.js doesn't seem to help