Skip to content

Conversation

@Adnan-cds
Copy link
Contributor

Additions:

  • A Webform Options config entity that lists Local custodian codes.
  • Programmatic addition of the above.
  • A local custodian code selector for the Address lookup Webform element.
  • Passes on the local custodian code to all relevant Geocoder plugins.

Closes #45

The local custodian code is a numeric code used by the OS Places API.  Every
local authority has been assigned a code.

Our address lookup element now applies the local custodian code to all Geocoder
plugins it is using.  Those plugins that understand this code then applies it to
the address lookup process.
@ekes
Copy link
Member

ekes commented Dec 14, 2023

Don't know if this is helpful for your passing to gecoders, but I've got a MR https://www.drupal.org/project/geocoder/issues/3406303 so you can pass a query directly to the geocoder plugin - and hence set additional parameters on the query (often setData() is used for passing custom restrictions etc. that a geocoder supports).

@Adnan-cds
Copy link
Contributor Author

but I've got a MR https://www.drupal.org/project/geocoder/issues/3406303

Hi Ekes,
Very useful feature. Thanks for pointing out. I will surely take a look :)

Not all Geocoder providers are configurable.  These cannot accept the
local_custodian_code parameter.
Correcting recently introduced config.
We are providing the Local custodian code through a GeocodeQuery rather than
individually passing it to each geocoder plugin.  This is a cleaner approach
made possible by Ekes' recent change to the geocoder contrib
module: https://www.drupal.org/project/geocoder/issues/3406303
…ion' into feature/borough-address-restriction
@Adnan-cds Adnan-cds marked this pull request as ready for review February 16, 2024 15:41
@Adnan-cds
Copy link
Contributor Author

Adnan-cds commented Feb 16, 2024

Ready for review. Uses the recently added "additional parameter passing to geocoders" feature of the geocoder module.

Test steps

  • Add the "LocalGov address lookup" element to a Webform.
  • While configuring the "Address lookup" element, select a Local authority: screenshot
  • If the address lookup element is using the "Localgov OS Places" geocoder, subsequent address lookups will remain limited to the selected local authority. All other geocoders should remain unaffected. "Sandown" is a good test candidate street name.

Resolves #45

@ekes
Copy link
Member

ekes commented Feb 20, 2024

Are the custodian codes going to be useful for https://github.com/localgovdrupal/localgov_os_places_geocoder_provider to be used in other geocoding?

@Adnan-cds
Copy link
Contributor Author

Are the custodian codes going to be useful for

I think so. The latest code change in the OS Places geocoder added support for the Local custodian code.

@finnlewis
Copy link
Member

So what's the plan here @Adnan-cds ? Move some config to other localgov modules or keep it here?

@Adnan-cds
Copy link
Contributor Author

So what's the plan here?

Let's see what Ekes thinks. We can move the Local custodian code configuration to localgov_geo. But then it would become site-wide rather than specific to a form element.

@andybroomfield
Copy link
Contributor

Form builders will still need to set this in the form as sometimes we want an address for Brighton & Hove only and sometimes we want a UK wide address.

@finnlewis
Copy link
Member

Discussion in Merge Tuesday:

  • Ekes: was just thinking of moving the custodian codes table to a more generic place. Could we have a call back?
  • Ekes But no objections to merging this and creating a new issue / merge request to change the source of custodian codes.

Copy link
Member

@finnlewis finnlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like there are no objections to merging this now and addressing the custodian codes move in another issue.

@Adnan-cds
Copy link
Contributor Author

Thanks. I have just raised a ticket to explore the use of a callback to source the custodian codes.

@Adnan-cds Adnan-cds merged commit b9d8ce4 into 1.x Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a local filter for LGD address lookup in Drupal forms

5 participants