Summary
The "Use image title as the caption" checkbox is disabled when using the flexslider field formatter in Views and Panels, and cannot be enabled.
A help message states "You need to enable the Title field for this image to be able to use it as a caption", but the enable link leads to a non-existant page:
admin/structure/types/manage/ctools/fields/field_foo
This error is displayed even if the Title field is already enabled for the field.
Cause
The $instance
array passed to the field formatter settings form does not have the ['settings']['title_field']
value set correctly.
Original report
Hi,
when I add a flexslider field in a pane and select flexslider formatter, I'm unable to check the "Use image title as the caption". It's grey/muted. Also, the link in "You need to enable the Title field for this image field to be able use it as a caption." lead to a non existent page: admin/structure/types/manage/ctools/fields/field_galleria_immagini?destination=admin/structure/types/manage/ctools/display#edit-instance-settings-title-field
Of course, the Title and Alt subfields for the flexslider field are enabled.
Comment | File | Size | Author |
---|---|---|---|
#5 | flexslider-image_title_as_caption-2204065-5.patch | 678 bytes | JKingsnorth |
Comments
Comment #1
Kojo Unsui CreditAttribution: Kojo Unsui commentedI don't know exactly why this succeeds with Panels. But having the same disabled checkbox, I solved it altering the Formatter styles form :
Comment #2
JKingsnorth CreditAttribution: JKingsnorth commentedFollowing up from jastraat's comment in #1861524: Add options for displaying title text on images as caption in FlexSlider Fields and my own experience, the checkbox also doesn't work in Views. I've updated the issue summary to account for this.
Comment #3
JKingsnorth CreditAttribution: JKingsnorth commentedI'll do some work on this today.
Comment #4
JKingsnorth CreditAttribution: JKingsnorth commentedThe field formatter in flexslider_fields.module checks to see if the
$instance['settings']['title_field']
is set. It disables the checkbox if it isn't.The
$instance
is passed in to the field formatter settings form.However, in Views the
$instance
array does not have the title_field and alt_field values set correctly - see the outputs attached. So this looks like an error in ctools / Views rather than Flexslider itself: the settings are not picked up correctly.Perhaps something with a better knowledge of Views / ctools would be able to pick this up and maybe open an issue in the relevant issue queue?
Comment #5
JKingsnorth CreditAttribution: JKingsnorth commentedDigging further: the instance used in Views and Panels is set by the
ctools_fields_fake_field_instance
function (in ctools\includes\fields.inc).This function sets the 'settings' to be the default settings for the image field - rather than the settings for that field on a particular content type. So because the title_field is not set by default on the 'image' field type, 0 is returned.
Since ctools doesn't know the context of the field instance (ie: what content type the field is attached to) then we will not be able to check whether the field is set in this way.
So my proposed solution is to not check whether or not the field is enabled when access the formatter via a ctools form (Views, Panels...). The check can remain when setting up the formatter anywhere else (such as via 'Manage display').
This also fixes the fact that the links to enable the field point to a non-existent page from Views, because the message will not be displayed.
Patch attached!
Comment #6
ckrinaThe patch from #5 applies and it solved the disabled check problem in Panels for 2.x-dev. Thanks!
Maybe another review to set RTBC.
Comment #7
Ether CreditAttribution: Ether commentedWill this patch be implemented in dev version ? Have this problem with last dev version.
Comment #8
JKingsnorth CreditAttribution: JKingsnorth commentedHi Ether, if you can confirm that the patch works then let us know and we can probably mark this as reviewed and tested. Then it is more likely to get picked up and implemented.
Comment #9
Ether CreditAttribution: Ether commentedPatch works when applied to the last dev version.
Comment #10
JKingsnorth CreditAttribution: JKingsnorth commentedRTBC then =] Thanks!
Comment #11
minorOffense CreditAttribution: minorOffense at Coldfront Labs Inc. commented