Ensure custom address fields are available in templates#118
Merged
duncanmcclean merged 3 commits into1.xfrom Jan 22, 2026
Merged
Ensure custom address fields are available in templates#118duncanmcclean merged 3 commits into1.xfrom
duncanmcclean merged 3 commits into1.xfrom
Conversation
|
Released as part of v1.0.0-beta.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request ensures that custom address fields added via the
fieldshook are available in templates.They aren't currently because the
Addressobject is passed to the fieldtype'saugmentmethod, which ultimately calls->toArray()on the address, which returns a fixed array of fields.To address this (see what I did there?), I've refactored the
Addressobject to accept an array, rather than arguments for each "part" of an address.I've also moved the address fields out of the fieldtype and into the main
Addressobject.Related: #111
Address::hook('fields')Technically, there shouldn't be any breaking changes in a beta. However... I only released this feature a few days ago and I'm pretty sure there's only 1 person using it, so I'm gonna break something and hope no one tells me off. 🙈
You'll need to change which
Addressclass you're importing:You'll also need to make sure you return the field handle as a key, rather than a nested array with
handle/fieldkeys: