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.
When a Field Formatter Settings Module comes looking for the instance display settings all it can find is the default one set in line 985 and so it often chokes because it is looking for something else often (custom displays) and with more details (type, etc):
'instance' => array('display' => array('default' => array('settings' => array()))),
because this is a DS field it has no fully stocked $instance array for the summary unless we make one...so...here is a feeble attempt at pacifying hook_field_formatter_settings_summary_alter() by passing in the current view mode along with some defaults to avoid more notices:
'instance' => array(
'display' => array(
$view_mode => array(
'label' => '',
'type' => '',
'weight' => '',
'settings' => array(),
'module' => '',
)
)
),
Comment | File | Size | Author |
---|---|---|---|
#1 | 1900014-2-fix-for-better-field-formatter-settings-summary-altering.patch | 733 bytes | jpstrikesback |
Comments
Comment #1
jpstrikesback CreditAttribution: jpstrikesback commentedAnd the patch.
Comment #2
swentel CreditAttribution: swentel commentedInteresting, there was another bug report ove at #1875750: Allow DS core fields to have alterable settings, include them in field_info_instance_settings() with a patch, but smaller. I think this one is probably better and solving it competely.
Comment #3
jpstrikesback CreditAttribution: jpstrikesback commentedCool! I missed that one. Would we ever need/want anything else in the instance array, or is this good enough for DS purposes?
Comment #4
swentel CreditAttribution: swentel commentedI /think/ that should be enough. I'm going to test this one over the weekend with other field formatter settings modules to see how it behaves.
Comment #5
markhalliwellKinda reiterating what I said in #1875750-6: Allow DS core fields to have alterable settings, include them in field_info_instance_settings(), but this would in fact silence the errors (which is similar to that issue). However it doesn't actually allow the settings for those fields to be saved.
Comment #6
swentel CreditAttribution: swentel commentedI've committed this one, let's figure out in the other one how to actually save :)