Problem/Motivation
Bugs being reported due to new wrappers field:
Warning: Undefined array key "wrappers" in Drupal\custom_field\Plugin\Field\FieldFormatter\BaseFormatter->getFormattedValues() (line 477 of modules/contrib/custom_field/src/Plugin/Field/FieldFormatter/BaseFormatter.php).
Warning: Trying to access array offset on value of type null in template_preprocess_custom_field_item() (line 119 of modules/contrib/custom_field/custom_field.module).
Steps to reproduce
Updating to 3.1 and saving a node, the rendered template is producing errors.
Issue fork custom_field-3501250
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
apmsooner commentedI rolled back to 3.03, added custom field and then updated to 3.1, cleared cache and rendered existing node, resaved, etc... but wasn't able to reproduce. Anyhow, i added a default value in case it isn't set for some reason so please try this patch against 3.1 and clear the cache and see if it resolves for you. Please report back so we can merge in or refactor if necessary.
Comment #4
apmsooner commentedOh, i see there were warnings in the logs. Just warnings so harmless but just the same, the patch should get rid of those. Ultimately resaving the field settings in manage display will also set the new values to config even if empty.
You should see something like this in config export for the field after resaving:
Comment #5
justcaldwellOkay, the patch did resolve the warnings. Thanks for the fast turnaround!
I also see the new config items after actually editing/saving the formatter settings per your instructions in the other issue.
We also use fences, so I'm curious to see if/how these new wrappers might interact with that module.
Comment #7
apmsooner commentedCool, thanks for the review. This setting works in conjunction with fences module but has no dependency or interaction with it. It basically does the same thing but at the subfield level so you can have full control over the output if desired.
Comment #8
justcaldwellThanks for the info on wrappers. And I just wanted to say, Custom Field really is an excellent contribution — thanks for your work!
Comment #9
apmsooner commentedThanks @justcaldwell, glad you're getting use from the module. A new release has been published that includes this fix.