Skip to content

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Aug 12, 2025

Related PR

Summary by CodeRabbit

  • New Features

    • WooCommerce product form fields now include default visibility, character-limit restrictions, and wider input widths across titles, content, prices, images, and reviews for a more consistent editing UI.
  • Bug Fixes

    • Radio inputs now reliably share the same bound name across inline and standard layouts and templates, ensuring proper grouping and single-selection behavior during form submission.

@arifulhoque7 arifulhoque7 requested a review from sapayth August 12, 2025 07:32
@arifulhoque7 arifulhoque7 self-assigned this Aug 12, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

Walkthrough

Adds 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

Cohort / File(s) Change Summary
Radio input templates
admin/form-builder/assets/js/components/field-radio/template.php, assets/js-templates/form-components.php
Added :name="option_field.name" to radio <input> elements inside inline and non-inline v-for loops. Note: in assets/js-templates/form-components.php this results in an additional/bilateral name binding on the same input.
WooCommerce post form field configs
includes/Admin/Forms/Post/Templates/Post_Form_Template_WooCommerce.php
Extended many post form field definitions with UI/config metadata keys: wpuf_visibility (via get_default_visibility_prop()), restriction_to: 'max', restriction_type: 'character', and width: 'large'. No logic or signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Suggested reviewers

  • sapayth

Poem

A twitch of whiskers, radios named right,
Inputs clustered neat in morning light.
Woo fields broaden, limits snug and small,
I hop, I nibble, I bless them all. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df3d32b and 980c39e.

📒 Files selected for processing (1)
  • assets/js-templates/form-components.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • assets/js-templates/form-components.php
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9ddcb1f and 4508820.

📒 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:

  1. Visibility control via wpuf_visibility with default settings
  2. Content restrictions with character limits where appropriate
  3. 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>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
: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.

@arifulhoque7 arifulhoque7 added the needs: dev review This PR needs review by a developer label Aug 12, 2025
@sapayth sapayth added needs: testing Dev Review Done and removed needs: dev review This PR needs review by a developer labels Aug 12, 2025
@Rubaiyat-E-Mohammad Rubaiyat-E-Mohammad added QA Approved This PR is approved by the QA team and removed needs: testing labels Aug 12, 2025
@sapayth sapayth merged commit 8fbf163 into weDevsOfficial:develop Aug 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dev Review Done QA Approved This PR is approved by the QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants