Great job on this module and on the new 2.0.
I notice that you added CKeditor support [1997964]. While this is probably a good thing in general, in my case I really prefer limit entries here to only plain text. In other fields, I'm able to select, on the content type form, whether to use plain text of a text editor (screenshot attached). Is it possible to expose this functionality for the Caption? If this issue is really outside the scope of this module, any advice is greatly appreciated. (I do have Better Formats installed...)
Thank you again!
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | image_field_caption-set_default_input_format-2026301-23.patch | 3.1 KB | skilip |
| #20 | image_field_caption-set_default_input_format-2026301-20.patch | 3.05 KB | istryker |
| Screen Shot 2013-06-23 at 1.56.33 PM.png | 68.62 KB | djake |
Comments
Comment #1
squarecandy commentedThanks for the great work here.
+1 on this feature request.
As a stop-gap solution I changed line 128 of image_field_caption.module so that it defaults to the plain text formater:
'#format' => isset($item['image_field_caption']) ? $item['image_field_caption']['format'] : 'plain_text',I know that's not a great or portable solution, but it works for me for now...
I guess in terms of the feature request, it would be great to see an option in the settings to use just a plain '#type' => 'textfield' as an alternative to the '#type' => 'text_format' in the module. Seems like the full WYSIWYG or formatted textarea is probably overkill for most typical uses of this module.
Comment #2
aaronbaumanAttached patch adds an option on the field configuration to set the default input format on the image caption's text_format input field.
Fallback is the default input filter format, given by filter_default_format().
In other words, for existing installs, the current behavior will not be affected.
Comment #3
jakob123 commentedDear aaronbauman, thanks for the patch! Tested and works perfectly, very nice!
Comment #4
steven_kropp commentedAny hints as to just making the setting Plain Text as the default? I know I can just overwrite line 128, but I was wondering is there a hook alter form or anything like that... my PHP skills aren't super great, I've been trying to write a custom module for this ability but I can't seem to affect it.
Comment #5
jibus commentedThanks for the patch !
Hope this will get commited soon !
Comment #6
ardarvin commented+1 on waiting for a commit.
Comment #7
scotwith1t+1 to see this committed too. My first attempt at using this module and having ckeditor pop up on these is certainly not needed and need a way to disable that! Thanks for a cool contribution! Patch works just fine so far.
Comment #8
awolfey commentedI'd like to offer an alternative patch. This patch adds a text_format settings field to set the default value and format for the caption. It shows the new field conditionally when Image Field Caption is enabled/checked for the image field.
Comment #9
wOOge commented#8 applies and works.
Comment #10
peter panes commentedThanks awolfey, #8 works for me to.
Comment #11
squarecandy commentedI tried #2 and #8 - I patched against latest dev. Using core 7.34 + wysiwyg + tinymce on input filter "Full HTML".
#8 is not working for me.
I get these php notices:
Notice: Undefined index: image_field_caption_wrapper in image_field_caption_field_instance_settings_form() (line 118 of .../sites/all/modules/image_field_caption/image_field_caption.module).
Notice: Undefined index: image_field_caption_wrapper in image_field_caption_field_instance_settings_form() (line 119 of .../sites/all/modules/image_field_caption/image_field_caption.module).
I get the new form for the default value, but no way to select a text format.
Surprised to see 2 people report it's working for them. Am I missing something?
#2 is working for me. Does not apply cleanly to current dev, but works once applied manually.
Comment #12
kreatil commentedI can confirm it is not working, as described by squarecandy in comment #11.
Using core 7.34 + wysiwyg + ckeditor. Although the selected text format is being memorized within the configuration of the image field, if I create a new node, always the system-wide default text format will show up.
Comment #13
awolfey commentedThis patch fixes issues in #11 and #12. It's to be applied by itself, not on top of the previous patches.
Thanks.
Comment #14
awolfey commentedComment #15
kreatil commentedPatch #13 works for me. Using core 7.34 + wysiwyg + ckeditor.
Comment #16
tannerjfco commented#13 is working for me as well.
Comment #17
tannerjfco commentedActually, did hit an error with this when testing as an authenticated user without ability to change input formats:
Comment #18
mkolar commented#13 working for me, thanks!
Comment #19
istryker commentedNew patch. Changes:
Added default settings to
image_field_caption_field_info_alter(). You no longer need the isset check inimage_field_caption_field_instance_settings_form().In
image_field_caption_field_widget_form_alter()it was overriding the image_field_caption enable setting with an array. #1 you should not overwrite something. #2 you should not change the type from an integer to an array.@tannerjfco I cannot reproduce #17 problem. I tested with an authenicated user without the default format. As admin I set the default format to (Full HTML). I think is fix with me add the default settings to the field info.
Comment #20
istryker commentedNew Patch fixes #2398237: If statement Control structure not following coding standard. (Cannot have 2 separate patches as they conflict).
Comment #21
joelhsmith commentedPatch #20 works for me. Using core 7.35 + wysiwyg + ckeditor. Thanks!
Comment #22
supermoos commentedPatch no longer applies on 7.x-2.x
Comment #23
skilip commentedRerolled patch from #20 against 7.x-2.x.
Comment #25
tyler.frankenstein commentedThanks everyone. I added a
hook_update_N()to set some sensible defaults for any existing image fields with captions enabled. I fixed a form#statebug, and also fixed a bug that would always display the caption, even if you later disable the caption on the field.Comment #27
vistree commentedHi Tyler,
patch works great for a single instance image field. I use image field caption together with plupload to buld upload multiple files.
After using your new dev-version the input format is set to the field default just for the FIRST image. For all other images I receive the following error:
Do you have an idea on how to solve this error?
Comment #28
tyler.frankenstein commentedThe short answer is to modify
image_field_caption_widget_process()to have some default fall back values. The longer answer is to dig deeper into why there are no default values. Perhaps my latest update hook inimage_field_caption.moduleisn't taking into account the scenario you describe. Either way, please open a new issue and reference this issue if the problem persists.Comment #29
drupalgideonWill this patch get rolled out into a proper release?
Comment #30
tyler.frankenstein commented@SkidNCrashwell, does the latest development snapshot of the module work for you? If so, I'd be comfortable releasing a new version, I just wanted to hear from a few more people on whether or not this actually solves the problem.
Comment #31
vistree commentedHi Tyler,
works for me - but as I wrote in #27 I receive erros for multi uploads.
I were able to solve this by https://www.drupal.org/node/2648938#comment-10796006
Is this something you could add to the patch?
Comment #32
Kostya19 commentedAfter this commit there was an issue in multi-item field: when I remove one item, captions of all items are removed. The issue was solve by comment above https://www.drupal.org/node/2648938#comment-10796006
Comment #33
garbo commentedI can confirm Stay14's comment #32 and the solution he mentions.
Comment #34
tyler.frankenstein commentedThank you everyone, I've applied the changes mentioned in #2648938: Using plupload assigns text format only to first image, grab the latest dev release of the module for this fix.