-
Notifications
You must be signed in to change notification settings - Fork 151
Fix/radio button fix and ec template not showing #1675
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
Fix/radio button fix and ec template not showing #1675
Conversation
WalkthroughAdds Vue :name bindings to radio inputs in two templates (one occurrence duplicates an existing name binding) and augments many WooCommerce post form field definitions with UI metadata keys (visibility, restriction settings, width). No public API or control-flow changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
admin/form-builder/assets/js/components/field-radio/template.php(2 hunks)admin/form-builder/assets/js/components/form-radio_field/template.php(1 hunks)assets/js-templates/form-components.php(2 hunks)includes/Admin/Forms/Post/Templates/Post_Form_Template_WooCommerce.php(9 hunks)includes/Free/Free_Loader.php(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
includes/Free/Free_Loader.php (1)
includes/Admin/Forms/Post/Templates/Post_Form_Template_Events_Calendar.php (1)
Post_Form_Template_Events_Calendar(12-228)
includes/Admin/Forms/Post/Templates/Post_Form_Template_WooCommerce.php (2)
includes/Fields/Field_Contract.php (1)
get_default_visibility_prop(892-897)includes/Admin/Forms/Form_Template.php (1)
get_default_visibility_prop(167-172)
🔇 Additional comments (4)
assets/js-templates/form-components.php (1)
523-523: Proper radio button grouping implementation.The addition of
:name="option_field.name"correctly ensures that radio buttons with the same name attribute are treated as a group, allowing only one selection per group. This is essential for proper form functionality and follows HTML standards for radio inputs.includes/Free/Free_Loader.php (1)
937-938: Events Calendar template re-enabled successfully.The re-enabling of the Events Calendar post form template looks correct. The template includes a built-in safety mechanism that sets
$this->enabled = class_exists( 'Tribe__Events__Main' )to ensure it only functions when The Events Calendar plugin is active.admin/form-builder/assets/js/components/field-radio/template.php (1)
19-19: Consistent radio button grouping implementation.The addition of
:name="option_field.name"in both inline and non-inline radio input sections ensures proper grouping behavior. This change is consistent with the pattern applied across other radio field templates in this PR.Also applies to: 36-36
includes/Admin/Forms/Post/Templates/Post_Form_Template_WooCommerce.php (1)
32-35: Enhanced field configuration for improved UI consistency.The addition of visibility properties, restriction settings, and width configuration across WooCommerce form fields enhances the form builder's capabilities. These changes provide:
- Visibility control via
wpuf_visibilitywith default settings- Content restrictions with character limits where appropriate
- Consistent width settings for better UI layout
The implementation correctly uses the inherited
get_default_visibility_prop()method and applies consistent configuration patterns across different field types.Also applies to: 54-58, 75-79, 97-98, 116-117, 132-133, 166-167, 185-189, 204-205
| :value="val" | ||
| :checked="is_selected(val)" | ||
| :class="builder_class_names('radio')">{{ label }}</label> | ||
| :checked="is_selected(val)">{{ label }}</label> |
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.
Missing name attribute for radio button grouping.
The radio input on line 23 lacks the crucial :name attribute that was added to other radio field templates in this PR. Without this, radio buttons won't be properly grouped, allowing multiple selections when only one should be allowed.
Apply this diff to add the missing name attribute:
- <input type="radio" :class="builder_class_names('radio')">
+ <input type="radio" :name="field.name" :class="builder_class_names('radio')">Also apply the same fix to line 10:
- :class="builder_class_names('radio')">
+ :name="field.name"
+ :class="builder_class_names('radio')">📝 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.
| :checked="is_selected(val)">{{ label }}</label> | |
| --- a/admin/form-builder/assets/js/components/form-radio_field/template.php | |
| +++ b/admin/form-builder/assets/js/components/form-radio_field/template.php | |
| @@ -9,7 +9,8 @@ | |
| <input | |
| type="radio" | |
| - :class="builder_class_names('radio')"> | |
| + :name="field.name" | |
| + :class="builder_class_names('radio')"> | |
| <label :checked="is_selected(val)">{{ label }}</label> | |
| @@ -22,7 +23,7 @@ | |
| <label | |
| - <input type="radio" :class="builder_class_names('radio')"> | |
| + <input type="radio" :name="field.name" :class="builder_class_names('radio')"> | |
| :checked="is_selected(val)">{{ label }}</label> |
🤖 Prompt for AI Agents
In admin/form-builder/assets/js/components/form-radio_field/template.php around
lines 10 and 26, the radio <input> elements are missing the :name binding so
radios won't be grouped; add the same name binding used elsewhere in this PR
(for example :name="field.name") to both input tags so all radios share the same
name and only one can be selected.
Related PR
Summary by CodeRabbit
New Features
Bug Fixes