When using the patch at http://drupal.org/node/741606#comment-7404872 to add a WYSIWYG editor to the summary of a body, the tag to replace the media [[..]] code with an image tag is not added to Drupal.settings.tagmap , as media_pre_render_text_format is not called on the summary field.

Attached patch adds the function call to the #pre-render element for elements of type 'textarea' . This covers the summary field.

I also had to alter media_pre_render_text_format to work on $element['#value'] rather than $element['value'][#'value']. I hope this doesn't break anything - could maybe cause some duplication of tags in the tagmap?

Files: 
CommentFileSizeAuthor
#6 media-7.x-2.x-wysiwyg-summary-support-1995030-6.patch884 bytesDevin Carlson
PASSED: [[SimpleTest]]: [MySQL] 154 pass(es).
[ View ]
#4 media-7.x-2.x-wysiwyg-summary-support-1995030-4.patch884 bytesdas-peter
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media-7.x-2.x-wysiwyg-summary-support-1995030-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#3 wysiwyg_summary-1995030-3.patch871 bytestripper54
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
media-wysiwyg-support-summary.patch1.16 KBtripper54
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Comments

TwoD’s picture

This looks a bit off to me, but I've only looked through Media's code briefly.
The value from "plain" textarea fields may not be processed with check_markup(), while text_format fields are pretty much guaranteed to be. Does it make sense to run this function if the field won't also be processed by Media's filter?

Also, adding it to textarea means [unless I'm mistaken] media_pre_render_text_format() will run twice or maybe even three times per text_format field. The text_format fields will by default get changed to a main textarea field in addition to the summary field.

I think an improved solution would be to only run media_pre_render_text_format() for text_format fields and call _media_generate_tagMap() for both $element['value']['#value'] and $element['summary']['#value'], if it exists.

tripper54’s picture

Assigned:Unassigned» tripper54
Status:Needs review» Needs work

You're quite right, that would be a much better approach.

I'll rework the patch accordingly.

tripper54’s picture

Assigned:tripper54» Unassigned
Status:Needs work» Needs review
StatusFileSize
new871 bytes
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Revised patch attached, now acts on $element['summary']['#value'] , as suggested by TwoD.

das-peter’s picture

Component:WYSIWYG integration» Code
Issue summary:View changes
Related issues:+#2159403: Make CKEditor plugin system modular and clean
StatusFileSize
new884 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media-7.x-2.x-wysiwyg-summary-support-1995030-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

While working on #2159403: Make CKEditor plugin system modular and clean I stumbled over this issue too. The attached patch is for media 7.x-2.x

Status:Needs review» Needs work

The last submitted patch, 4: media-7.x-2.x-wysiwyg-summary-support-1995030-4.patch, failed testing.

Devin Carlson’s picture

Status:Needs work» Needs review
StatusFileSize
new884 bytes
PASSED: [[SimpleTest]]: [MySQL] 154 pass(es).
[ View ]

A reroll of #4.

Status:Needs review» Needs work

The last submitted patch, 6: media-7.x-2.x-wysiwyg-summary-support-1995030-6.patch, failed testing.

Status:Needs review» Needs work

The last submitted patch, 6: media-7.x-2.x-wysiwyg-summary-support-1995030-6.patch, failed testing.

das-peter’s picture

Version:7.x-1.x-dev» 7.x-2.x-dev
Status:Needs work» Needs review

That patch will not apply because the version for the issue is / was set to 7.x-1.x-dev - but the updated patch is for 7.x-2.x-dev .
I switch the version for now to test the latest patch.
Help me to not forget to switch back to 7.x-1.x-dev again ;)

das-peter’s picture