Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I cannot delete filtered html caption value without changing format to plain text for an image embedded in a ckeditor enabled field like body field. You can update the html value for the field, but if you remove it, the value is unchanged when you look at the source
is left unchanged.
e.g.
[[{"fid":"7396","view_mode":"full","fields":{"format":"full","field_file_image_alt_text[und][0][value]":false,"field_file_image_title_text[und][0][value]":false,"field_caption[und][0][value]":"%3Cp%3EMedia%20browser%20Caption%3C%2Fp%3E","field_caption[und][0][format]":"filtered_html","field_credit[und][0][value]":"","field_classes[und][0][value]":"right"},"type":"media","field_deltas":{"1":{"format":"full","field_file_image_alt_text[und][0][value]":false,"field_file_image_title_text[und][0][value]":false,"field_caption[und][0][value]":"%3Cp%3EMedia%20browser%20Caption%3C%2Fp%3E","field_caption[und][0][format]":"filtered_html","field_credit[und][0][value]":"","field_classes[und][0][value]":"right"}},"attributes":{"height":"1500","width":"2250","style":"width: 350px; height: 233px; float: right;","class":"media-element file-full","data-delta":"1"}}]]
when changed to plain text and deleted you end up with:
[[{"fid":"7396","view_mode":"full","fields":{"format":"full","field_file_image_alt_text[und][0][value]":false,"field_file_image_title_text[und][0][value]":false,"field_caption[und][0][value]":"","field_caption[und][0][format]":"plain_text","field_credit[und][0][value]":"","field_classes[und][0][value]":"right"},"type":"media","field_deltas":{"1":{"format":"full","field_file_image_alt_text[und][0][value]":false,"field_file_image_title_text[und][0][value]":false,"field_caption[und][0][value]":"","field_caption[und][0][format]":"plain_text","field_credit[und][0][value]":"","field_classes[und][0][value]":"right"}},"attributes":{"height":"1500","width":"2250","style":"width: 350px; height: 233px; float: right;","class":"media-element file-full","data-delta":"1"}}]]
Comment | File | Size | Author |
---|---|---|---|
#5 | media-cannot_remove_empty_field-2835833-5.patch | 816 bytes | brockfanning |
|
Comments
Comment #2
aaronpinero CreditAttribution: aaronpinero commentedI am having a similar problem with any field on an Image file that is embedded using ckeditor. So, I can change the value of the alt attribute, title attribute, and two other custom fields I added for images. However, I cannot make the fields blank (by deleting the content in the field) if I have previously added some text.
Comment #3
brockfanning CreditAttribution: brockfanning commentedI haven't run into this, but can test it out. @aaronpinero and @StephenRobinson, are you using the CKEditor library via the WYSIWYG module, or via the Media CKEditor module?
Comment #4
brockfanning CreditAttribution: brockfanning commentedCorrection: I can recreate it in the Media CKEditor approach. Haven't tested it with the WYSIWYG approach.
Comment #5
brockfanning CreditAttribution: brockfanning commentedHere's a patch that fixes it for me.
Comment #6
brockfanning CreditAttribution: brockfanning commentedComment #7
joseph.olstadrelease to follow shortly.
Please see follow-up issue
#2838905: update book page documentation for media installation and setup of media module with or without media_ckeditor and ckeditor
Comment #9
aaronpinero CreditAttribution: aaronpinero commented@brockfanning I am using CKEditor version 4.4.8 with WYSIWYG version 7.x-2.2+76-dev
I ran into this problem once before with an earlier version of Media module. If I recall, the code was interpreting an empty string as no new value provided, rather than accounting for the possibility that an empty string was the new value.
Comment #10
joseph.olstad@aaronpinero, have a look at @brockfannings' recipe , (in case you want to try his setup)
here's a link
https://www.drupal.org/files/media-ckeditor.make__7.yml
pay attention to the versions of media modules and its dependencies and libraries used in the recipe.
also, check the media installation page, might be helpful as well. There is also a recipe page
https://www.drupal.org/node/1298532
if you have a good recipe, feel free to add it, open a new ticket if you want help with your own custom recipe, let us know what versions of related modules you're using and which ones are enabled and we may at some point require configuration settings , steps to reproduce your setup.
Comment #11
aaronpinero CreditAttribution: aaronpinero commented@joseph.olstad I'm sorry, I believe I indicated the specific versions of the modules involved when I reported I had encountered this issue. I will try this with the latest release of the media module (instead of the version of the module that was used in the original report -- beta 12) but I expect, based on the response received, that the error was not resolved.
Comment #12
joseph.olstad7.x-2.0-rc1 is the latest version/release of the media module 7.x-2.x branch.