-
-
Notifications
You must be signed in to change notification settings - Fork 228
Add phone form field #1440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Add phone form field #1440
Conversation
WalkthroughA new PHP partial template has been added to render a telephone input field. The template supports two modes: preview mode displays a tel link or placeholder, while standard mode renders an input element with optional autocomplete, validation attributes, and a datalist for suggestions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@modules/backend/widgets/form/partials/_field_phone.php`:
- Line 1: The file’s top HTML comment incorrectly reads "URL" due to copy-paste;
update the comment in the _field_phone.php partial to say "Phone" (or a more
descriptive "Phone field") so it accurately reflects the field purpose; locate
the comment token at the top of the partial and replace the text "URL" with
"Phone".
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
modules/backend/widgets/form/partials/_field_phone.php
🧰 Additional context used
🧬 Code graph analysis (1)
modules/backend/widgets/form/partials/_field_phone.php (1)
modules/backend/classes/FormField.php (3)
options(228-246)size(217-221)getAttributes(431-445)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: windows-latest / PHP 8.3
- GitHub Check: windows-latest / PHP 8.1
- GitHub Check: ubuntu-latest / PHP 8.4
- GitHub Check: ubuntu-latest / PHP 8.1
- GitHub Check: windows-latest / PHP 8.2
- GitHub Check: windows-latest / PHP 8.4
- GitHub Check: ubuntu-latest / PHP 8.3
- GitHub Check: ubuntu-latest / PHP 8.2
- GitHub Check: windows-latest / JavaScript
🔇 Additional comments (3)
modules/backend/widgets/form/partials/_field_phone.php (3)
11-23: LGTM!Preview mode implementation is well-structured with proper security measures (
target="_blank"paired withrel="noopener noreferrer") and consistent output escaping viae().
25-39: Implementation looks good with one note onsizeattribute semantics.The conditional attribute rendering with type validation is well done. The
is_numeric($field->size)check on line 36 correctly filters out the framework's string-based size values (like'large'), avoiding conflict with the HTMLsizeattribute.Based on the relevant snippet showing
FormField::size()defaults to'large', the numeric check ensures only explicit numeric values set the HTML attribute. Consider documenting this distinction in the field's YAML documentation to avoid confusion between the framework'ssizeproperty and the HTML input'ssizeattribute.
40-47: LGTM!The datalist implementation correctly handles both associative and sequential arrays via the integer key check on line 43, and properly applies translation to labels for i18n support.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| @@ -0,0 +1,49 @@ | |||
| <!-- URL --> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect comment: should be "Phone" not "URL".
This appears to be a copy-paste artifact from another field partial.
Suggested fix
-<!-- URL -->
+<!-- Phone -->📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <!-- URL --> | |
| <!-- Phone --> |
🤖 Prompt for AI Agents
In `@modules/backend/widgets/form/partials/_field_phone.php` at line 1, The file’s
top HTML comment incorrectly reads "URL" due to copy-paste; update the comment
in the _field_phone.php partial to say "Phone" (or a more descriptive "Phone
field") so it accurately reflects the field purpose; locate the comment token at
the top of the partial and replace the text "URL" with "Phone".
|
@mjauvin can you do up a docs PR for this field too? ❤️ |
Done! |
Related docs PR: wintercms/docs#255
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.