Problem/Motivation
PHP Fatal error on node page when using the Map Formatter on an Address field.
TypeError: Cannot access offset of type string on string in Drupal\geolocation\Plugin\Field\FieldFormatter\GeolocationMapFormatterBase->getMapObjects() (line
432 of modules/contrib/geolocation/src/Plugin/Field/FieldFormatter/GeolocationMapFormatterBase.php).Steps to reproduce
Add an address field on a content type.
Set the field display as Geolocation Formatter - Map
Create a node of that content type and add a valid address
View the page it will result in a WSOD
Proposed resolution
Looks like AddressFieldProvider's getLocationFromItem method is not returning an array of render arrays. Instead it's returning a flat render array. The geolocation map formatter expects this function to return a list of render arrays.
Issue fork geolocation-3609692
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 #4
christianadamski commentedFair enough. Minimal alter to appease PHPCS.
Thanks!