We upgraded our development environment to 7.x-1.16 and discovered that some of the fieldable panels panes titles were displaying twice. If I re-save each pane in panelizer or pages, the duplicate Title is removed, which is time-consuming.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | upgrade-causes-fieldable-panels-panes-titles-to-appear-twice-2426241-8.patch | 2.06 KB | adamsro |
Comments
Comment #1
dsnopekDid you run the updates (ie
drush updb) and clear the cache?Comment #2
dsnopekComment #3
adamsro commentedOk so it seems that the issue comes from a bad line in panopoly_magic,
$form['view_mode']['#value'] = reset($form['view_mode']['#options']);, that sets the view mode equal to the view mode's label instead of value when only one view mode option exists. This wasn't an issue before but now functionfieldable_panels_panes_field_extra_fields_display_alteris used to hide the title, but only if view_mode is equal to 'full', not 'Full'.I think a good fix might be to change
reset($form['view_mode']['#options'])tokey($form['view_mode']['#options'])?Comment #4
dsnopekOh, interesting... Thanks, @adamsro! I'm finally able to reproduce it. I wasn't able to before because my -dev site has at least one extra view mode from the Diff module, so that code wasn't getting triggered for me. And I can see that re-saving is working only because FPP now has the 'Preview' view mode. I've added new issue to clean up the view mode options:
#2430889: Hide 'preview' and 'diff_standard' view modes when adding FPPs
Your patch fixes the issue for me with new panes! But 'Full' (rather than 'full') will already be saved in the pane configuration for existing content, so we'll need a
hook_update_N()put in panopoly_magic.install as well. I recommend taking a look atpanopoly_widgets_update_7012()in panopoly_widgets.install as an example, which also has to update the pane configuration for all panes of a certain type.Thanks again!
Comment #5
dsnopekComment #6
adamsro commented@dsnopek thanks for being so on top of the issue queue. Drupal maintainer of the year award to you!
I think this patch should get everything updated correctly.
Comment #7
dsnopekThanks! :-)
Here's some quick code review (though I haven't had a chance to actually test this):
While it probably doesn't matter (since this is an update hook that'll only ever be run once), I don't think it makes sense to loop over the
$view_mode_optionsbecause there is only one$pane->configuration['view_mode']- so why check multiple times?We could add a
breakstatement after it's found, but how about something like this instead:That should be a little more direct and clearer.
Thanks again!
Comment #8
adamsro commentedThat's a good point. Here's the updated patch!
Comment #10
dsnopekThanks! Looks and works great. :-) Committed!