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?

Support from Acquia helps fund testing for Drupal Acquia logo

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
FileSize
871 bytes

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
FileSize
884 bytes

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
FileSize
884 bytes

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

junaidpv’s picture

Updated for latest dev 7.x-2.x.

junaidpv’s picture

Minor update and removed white space error on git apply.

  • joseph.olstad committed 3614a88 on 7.x-2.x authored by junaidpv
    Issue #1995030 by tripper54, junaidpv, das-peter, Devin Carlson: Support...
joseph.olstad’s picture

Status: Needs review » Fixed

looks good for 7.x-2.x dev , thanks

Status: Fixed » Closed (fixed)

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