Repository navigation
feat: Add phone format properties to resolve issue #441 - #475
Conversation
- Create new PhoneFormatProperties object type with label, mask, regex, instruction, and type fields - Add phoneFormatProperties field to FieldWithPhoneFormat interface with resolver - Support custom phone formats via gform_phone_formats filter - Update tests to include new phoneFormatProperties field - Register PhoneFormatProperties type in TypeRegistry Resolves: AxeWP#441
- Fix PHPCS violations in FieldWithPhoneFormat.php - Add proper inline comment punctuation - Add phpcs:ignore for third-party gform_phone_formats hook - Add changelog entry for phoneFormatProperties feature
|
Thanks so much for submitting this @chetanupare 🙇 I should hopefully have time over the weekend to review. (Feel free to ignore the copilot comments I just triggered - 80% of the time they're slop, but every once in a while they catch something helpful) |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Pull request overview
This PR adds a phoneFormatProperties field to phone fields in the GraphQL schema to expose detailed phone format configuration (label, mask, regex, instruction, and type) from Gravity Forms. This addresses issue #441 where users needed access to format properties beyond just the format name for frontend implementation.
Changes:
- Added new
PhoneFormatPropertiesGraphQL object type to represent phone format configuration details - Extended
FieldWithPhoneFormatinterface withphoneFormatPropertiesfield including resolver that uses thegform_phone_formatsfilter - Updated tests to query the new field and added test expectations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Type/WPObject/PhoneFormatProperties.php | New GraphQL object type defining the structure for phone format properties |
| src/Type/WPInterface/FieldSetting/FieldWithPhoneFormat.php | Added phoneFormatProperties field with resolver that applies gform_phone_formats filter |
| src/Registry/TypeRegistry.php | Registered the new PhoneFormatProperties type in the type registry |
| tests/wpunit/PhoneFieldTest.php | Updated test query to include phoneFormatProperties field |
| tests/_support/Helper/GFHelpers/ExpectedFormFields.php | Added test expectations for phoneFormatProperties field |
| CHANGELOG.md | Documented the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add dedicated PhoneFieldInternationalFormatTest - Normalize phone format properties for null/false values - Adjust phone format expectations for international mask/regex
chetanupare
left a comment
There was a problem hiding this comment.
Please Review!
|
Ack - just realized that my pending notes to myself were published instead of pending for me to get to... should be able to polish this off and merge this week. |
|
Failing schema test is from the fix in #483. I think this is good to merge now 🤔 |
|
@chetanupare take a look at the updated schema shape (and PR description), and lemme know what you think (here or on the issue). This gets it into the plugin asap while keeping the breaking schema change for the ideal implementation. |
Looked at the updated schema and PR description |
[edited by @justlevine ]
What
Adds a new
GfPhoneFormatGraphQL type to Phone fields, providing detailed format information (label, mask, regex, instruction, type).Additionally, deprecates
PhoneField.phoneFormatin favor ofPhoneField.phoneFormatTypeto prepare for a future breaking change wherephoneFormatwill return theGfPhoneFormattype.Why
How
Created PhoneFormatProperties object type
Added field to FieldWithPhoneFormat interface with resolver
Supports custom formats via gform_phone_formats filter
Updated tests and registered new type
Testing Instructions
Additional Info
Example Query
Response:
Checklist: