Problem/Motivation
If a field formatter has cascaded settings e.g. $settings['markup'] = array('wrapper' => 'div', 'classes' => 'i-m-a-class')
it's not possible to set the settings in panels / panelizer.
As far as I see this is because ctools_fields_get_field_formatter_settings_form()
doesn't set the #tree
property to the field formatter settings form.
But field_ui.admin.inc (line 912) does this:
$table = array(
'#type' => 'field_ui_table',
'#tree' => TRUE,
...
if ($settings_form) {
$table[$name]['format']['#cell_attributes'] = array('colspan' => 3);
$table[$name]['format']['settings_edit_form']
This means the settings form is also affected by the #tree
property.
Debugging further shows that without the #tree
property the function ctools_entity_field_content_type_formatter_styles_submit()
can't find the cascaded field formatter settings in the form values and thus those settings are ignored.
Proposed resolution
Set the #tree
property in ctools_fields_get_field_formatter_settings_form()
.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
The structure of the form values changes.
Comment | File | Size | Author |
---|---|---|---|
ctools-casceded-field-formatter-settings-not-stored.patch | 641 bytes | das-peter |
Comments
Comment #1
das-peter CreditAttribution: das-peter commentedComment #2
das-peter CreditAttribution: das-peter commentedComment #3
kristiaanvandeneyndeTested to work, thanks for the patch!
Comment #4
AnybodyThanks a lot. It would be great to have this in the next .dev release. Is that possible?
Comment #5
AnybodyWho will have a look at this and take this into dev? :)
This is really problematic for some modules. I hope it is okay though to set the priority up.
Comment #6
ItangSanjana CreditAttribution: ItangSanjana commentedFYI, issue on https://www.drupal.org/node/1876522 is fixed by applying the patch above. Thanks.
Comment #7
TanvirAhmad CreditAttribution: TanvirAhmad commentedPatch worked for me as well. Thanks.
Comment #8
mdeltito CreditAttribution: mdeltito commented+1 for this patch, this resolves issues with the settings for bg_image_formatter
Comment #9
japerryLooks good, Committed.
Comment #11
kristiaanvandeneyndeUgh, just noticed something after this got committed:
Should be:
Otherwise the if-statement is always TRUE.
Comment #12
maximpodorov CreditAttribution: maximpodorov commentedI created the new issue and attached the patch (using the change kristiaanvandeneynde proposed) here: #2397709: Set #tree property in the proper place