Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class="wpuf-block text-sm/6 wpuf-font-medium wpuf-text-gray-900 !wpuf-mb-0">
<input
type="radio"
:value="key"
:name="option_field.name"
v-model="value"
:class="builder_class_names('radio')">
{{ option }}
Expand All @@ -32,6 +33,7 @@ class="wpuf-flex wpuf-items-center"
type="radio"
:value="key"
v-model="value"
:name="option_field.name"
:class="builder_class_names('radio')">
{{ option }}
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class="wpuf-flex wpuf-items-center">
<input type="radio" :class="builder_class_names('radio')">
<label
: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.

</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions assets/js-templates/form-components.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ class="wpuf-block text-sm/6 wpuf-font-medium wpuf-text-gray-900 !wpuf-mb-0">
<input
type="radio"
:value="key"
:name="option_field.name"
v-model="value"
:class="builder_class_names('radio')">
{{ option }}
Expand Down Expand Up @@ -1379,8 +1380,7 @@ class="wpuf-flex wpuf-items-center">
<input type="radio" :class="builder_class_names('radio')">
<label
:value="val"
:checked="is_selected(val)"
:class="builder_class_names('radio')">{{ label }}</label>
:checked="is_selected(val)">{{ label }}</label>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public function __construct() {
'default' => '',
'size' => '40',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'restriction_to' => 'max',
'restriction_type' => 'character',
'width' => 'large',
],
[
'input_type' => 'textarea',
Expand All @@ -47,7 +51,11 @@ public function __construct() {
'insert_image' => 'yes',
'word_restriction' => '',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'restriction_to' => 'max',
'restriction_type' => 'character',
'text_editor_control' => [],
'width' => 'large',
],
[
'input_type' => 'textarea',
Expand All @@ -64,7 +72,11 @@ public function __construct() {
'default' => '',
'rich' => 'no',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'restriction_to' => 'max',
'restriction_type' => 'character',
'text_editor_control' => [],
'width' => 'large',
],
[
'input_type' => 'text',
Expand All @@ -82,6 +94,8 @@ public function __construct() {
'min_value_field' => '0',
'max_value_field' => '',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'width' => 'large',
],
[
'input_type' => 'text',
Expand All @@ -99,6 +113,8 @@ public function __construct() {
'min_value_field' => '0',
'max_value_field' => '',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'width' => 'large',
],
[
'input_type' => 'image_upload',
Expand All @@ -113,6 +129,8 @@ public function __construct() {
'css' => '',
'max_size' => '1024',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'width' => 'large',
],
[
'input_type' => 'image_upload',
Expand Down Expand Up @@ -145,6 +163,8 @@ public function __construct() {
'hidden' => 'Hidden',
],
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'width' => 'large',
],
[
'input_type' => 'textarea',
Expand All @@ -162,7 +182,11 @@ public function __construct() {
'rich' => 'no',
'word_restriction' => '',
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'restriction_to' => 'max',
'restriction_type' => 'character',
'text_editor_control' => [],
'width' => 'large',
],
[
'input_type' => 'checkbox',
Expand All @@ -177,6 +201,8 @@ public function __construct() {
'_enable_reviews' => 'Enable reviews',
],
'wpuf_cond' => $this->conditionals,
'wpuf_visibility' => $this->get_default_visibility_prop(),
'width' => 'large',
],
];
$this->form_settings = [
Expand Down
4 changes: 2 additions & 2 deletions includes/Free/Free_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,46 +181,46 @@
$new_sections = [
[
'id' => 'wpuf_sms',
'title' => __( 'SMS', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 184 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-format-status',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
],
[
'id' => 'wpuf_social_api',
'title' => __( 'Social Login', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 191 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-share',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
],
[
'id' => 'user_directory',
'title' => __( 'User Directory', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 198 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-list-view',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
],
[
'id' => 'wpuf_payment_invoices',
'title' => __( 'Invoices', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 205 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-media-spreadsheet',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
],
[
'id' => 'wpuf_payment_tax',
'title' => __( 'Tax', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 212 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-media-text',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
],
[
'id' => 'wpuf_content_restriction',
'title' => __( 'Content Filtering', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 219 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'icon' => 'dashicons-admin-network',
'class' => 'pro-preview-html',
'is_pro_preview' => true,
]

Check failure on line 223 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

There should be a comma after the last array item in a multi-line array.
];

return array_merge( $sections, $new_sections );
Expand All @@ -239,8 +239,8 @@
$crown_icon_path = WPUF_ROOT . '/assets/images/crown.svg';
$settings_fields['wpuf_general'][] = [
'name' => 'comments_per_page',
'label' => __( 'Comments Per Page',

Check failure on line 242 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening parenthesis of a multi-line function call must be the last content on the line
'wp-user-frontend' ) . '<span class="pro-icon"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 243 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.

Check failure on line 243 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing parenthesis of a multi-line function call must be on a line by itself

Check failure on line 243 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Multi-line function call not indented correctly; expected 12 spaces but found 36
'desc' => __( 'Show how many comments per page in comments add-on', 'wp-user-frontend' ),
'type' => 'number',
'default' => '20',
Expand All @@ -249,8 +249,8 @@
];
$settings_fields['wpuf_general'][] = [
'name' => 'ipstack_key',
'label' => __( 'Ipstack API Key',

Check failure on line 252 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening parenthesis of a multi-line function call must be the last content on the line
'wp-user-frontend' ) . '<span class="pro-icon"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 253 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.

Check failure on line 253 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing parenthesis of a multi-line function call must be on a line by itself

Check failure on line 253 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Multi-line function call not indented correctly; expected 12 spaces but found 36
'desc' => sprintf(
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag
__( '%1$sRegister here%2$s to get your free ipstack api key', 'wp-user-frontend' ),
Expand All @@ -261,8 +261,8 @@
];
$settings_fields['wpuf_general'][] = [
'name' => 'gmap_api_key',
'label' => __( 'Google Map API',

Check failure on line 264 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening parenthesis of a multi-line function call must be the last content on the line
'wp-user-frontend' ) . '<span class="pro-icon"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 265 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.

Check failure on line 265 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing parenthesis of a multi-line function call must be on a line by itself

Check failure on line 265 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Multi-line function call not indented correctly; expected 12 spaces but found 36
'desc' => __( '<a target="_blank" href="https://developers.google.com/maps/documentation/javascript/get-api-key">API</a> key is needed to render Google Maps',
'wp-user-frontend' ),
'class' => 'pro-preview',
Expand All @@ -271,7 +271,7 @@
$settings_fields['wpuf_my_account'][] = [
'name' => 'show_edit_profile_menu',
'label' => __( 'Edit Profile',
'wp-user-frontend' ) . '<span class="pro-icon"> ' . file_get_contents( $crown_icon_path ) . '</span>',

Check warning on line 274 in includes/Free/Free_Loader.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
'desc' => __( 'Allow user to update their profile information from the account page',
'wp-user-frontend' ),
'type' => 'checkbox',
Expand Down Expand Up @@ -934,8 +934,8 @@
public function post_form_templates( $integrations ) {
$integrations['post_form_template_woocommerce'] = new Post_Form_Template_WooCommerce();

// turning off events calendar for their breaking changes
// $integrations['post_form_template_events_calendar'] = new Post_Form_Template_Events_Calendar();
// Re-enabled Events Calendar template
$integrations['post_form_template_events_calendar'] = new Post_Form_Template_Events_Calendar();

return $integrations;
}
Expand Down
Loading