Since the last update the geocoding of the address cam no longer works on my site. I feel that the documentation is no longer relevant :
https://www.drupal.org/docs/8/modules/geolocation-field/configuring-inte...
When I register a user account with its address, the Geolocation field is empty. Here is the message in the logs :
Notice: Undefined index: ignore in geolocation_address_geolocation_field_map_widget_alter() (line 60 of /var/www/www-example-com/web/modules/contrib/geolocation/modules/geolocation_address/geolocation_address.module) #0 /var/www/www-example-com/web/core/includes/bootstrap.inc(587): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/www-s1...', 60, Array) #1 /var/www/www-example-com/web/modules/contrib/geolocation/modules/geolocation_address/geolocation_address.module(60): _drupal_error_handler(8, 'Undefined index...', '/var/www/www-s1...', 60, Array) #2 /var/www/www-example-com/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): geolocation_address_geolocation_field_map_widget_alter(Array, Array, NULL) #3 /var/www/www-example-com/web/modules/contrib/geolocation/src/Plugin/Field/FieldWidget/GeolocationMapWidgetBase.php(354): Drupal\Core\Extension\ModuleHandler->alter('geolocation_fie...', Array, Array) #4 /var/www/www-example-com/web/modules/contrib/geolocation/modules/geolocation_leaflet/src/Plugin/Field/FieldWidget/GeolocationLeafletWidget.php(51): Drupal\geolocation\Plugin\Field\FieldWidget\GeolocationMapWidgetBase->form(Object(Drupal\Core\Field\FieldItemList), Array, Object(Drupal\Core\Form\FormState), NULL) #5 /var/www/www-example-com/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(177): Drupal\geolocation_leaflet\Plugin\Field\FieldWidget\GeolocationLeafletWidget->form(Object(Drupal\Core\Field\FieldItemList), Array, Object(Drupal\Core\Form\FormState)) #6 /var/www/www-example-com/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php(125): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object(Drupal\user\Entity\User), Array, Object(Drupal\Core\Form\FormState)) #7 /var/www/www-example-com/web/core/modules/user/src/AccountForm.php(277): Drupal\Core\Entity\ContentEntityForm->form(Array, Object(Drupal\Core\Form\FormState), Object(Drupal\user\Entity\User)) #8 /var/www/www-example-com/web/core/lib/Drupal/Core/Entity/EntityForm.php(117): Drupal\user\AccountForm->form(Array, Object(Drupal\Core\Form\FormState)) #9 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #10 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormBuilder.php(519): call_user_func_array(Array, Array) #11 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormBuilder.php(276): Drupal\Core\Form\FormBuilder->retrieveForm('user_form', Object(Drupal\Core\Form\FormState)) #12 /var/www/www-example-com/web/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\user\ProfileForm), Object(Drupal\Core\Form\FormState)) #13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #14 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #15 /var/www/www-example-com/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #17 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #18 /var/www/www-example-com/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /var/www/www-example-com/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #20 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/www-example-com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/www-example-com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/www-example-com/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/www-example-com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/www-example-com/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/www-example-com/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #30 {main}.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 3092054-16-geolocation-address-settings-bc.patch | 3.38 KB | berdir |
| #4 | 3092054-4-geolocation-address-form-handling.patch | 12.77 KB | christianadamski |
Comments
Comment #2
christianadamski commentedDoes that still happen?
Comment #3
zenimagine commentedNo it does not always happen but very often
Comment #4
christianadamski commentedComment #5
christianadamski commentedComment #7
chris matthews commentedI'm not sure this is fixed as I applied the patch in #4 and I'm still experiencing this issue.
Drupal 8.8.1
Address 8.x-1.7
Geolocation 8.x-3.0-rc2
PHP 7.3.12
'Geolocation Google Maps API - Geocoding and Map' widget settings:
The 'Enable address integration' = On
Geocoder plugin = Google Geocoding API
Select address field = Address
Synchronization = Automatically
Direction = Full Duplex | Address <> Geolocation
When I enter an address it does not get synced to the geolocation field.
Comment #8
christianadamski commentedIt works fine here with latest -dev. I know this is not that nice to hear, but it means I need more precise instructions on how to reproduce this issue.
Comment #9
chris matthews commentedThanks Christian, would you be able to push the current -dev to a new tagged release so I can test it out? The reason for a new tagged release is I have a Composer managed site (without a continuous integration workflow) on Pantheon's hosting platform, which makes it difficult to manage -dev releases as Pantheon cannot handle the git submodules that are created from -dev releases on Drupal.org. There is a way to get around it of course, but it can cause problems.
Comment #10
christianadamski commentedCoincidentally just did.
Gonna close this issue. Open a new one, once you are able to reproduce.
Comment #11
berdirThe rename of geocoder_settings to just settings here breaks existing configuration and causes php notices, what's the reason for that change?
Notice: Undefined index: settings in geolocation_address_geolocation_field_map_widget_alter() (line 56 of .../geolocation/modules/geolocation_address/geolocation_address.module)
Comment #12
christianadamski commented@Berdir, that was a mistake from the start. To support multiple geocoders at multiple places like views, fields, etc. the settings have to be stored in a known place. The formGeocoderAttach() or something like this expects all data in 'settings'. Else those are effectively ignored.
Changing this now is unfortunate, but I don't see an alternative. Any ideas?
Comment #13
berdirI don't understand why the key needs to change, it's just a rename, why does it matter? But, if that rename is necessary then you could add a BC check for the old key and ensure not only in geolocation_address_field_widget_third_party_settings_form() but also in geolocation_address_geolocation_field_map_widget_alter() that you add defaults, possibly with a helper function so they're easy to keep in sync. That will also make it easier to add new optional settings later on.
Also, you didn't update the config schema: modules/geolocation_address/config/schema/geolocation_address.field.schema.yml, that still has the old key.
Comment #14
berdirI can provide a patch with what I have in mind if that makes sense to you.
Comment #15
christianadamski commentedOh dear. Yes, a patch would be nice.
Comment #16
berdirOk, here we go, with a helper function that adds defaults and copies over the existing key. I also simplified how the defaults are applied, as we don't actually have any recursive defaults that need to be included here.
Note that the updated config schema will fail when running test with strict config schema, thought about adding a dummy old key as well but I think that's a good thing, then people can update their default configuration in modules/install profiles.
Comment #18
christianadamski commentedComment #19
chris matthews commentedCan this commit be pushed to a -rc4 release now so folks don't have to add the patch manually or use -dev?
Comment #20
christianadamski commentedI will release a rc-4 soon. But in the meantime: you could just add patches to your composer.json, can you?
Comment #21
zenimagine commentedthanks, I tested the DEV version and it fixes the problems
Comment #22
chris matthews commented@ChristianAdamski, I can but I didn't want to add yet another patch if I didn't have to. Thanks for releasing -rc4 soon.
Comment #23
zenimagine commented@ChristianAdamski The problem is corrected, but not for Photon.
Comment #24
zenimagine commentedComment #25
christianadamski commentedPhoton works fine here. However, there are very few country formatting plugins, defining how to map the individual address elements to address fields. You would need to write these yourself. See
https://git.drupalcode.org/project/geolocation/tree/8.x-3.x/modules/geol...
Comment #26
christianadamski commented