Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ js/formidable_styles.js
js/formidable_admin.js
js/bootstrap-multiselect.js
js/formidable-settings-components.js
js/formidable-web-components.js
js/frm_testing_mode.js
js/welcome-tour.js

Expand Down
53 changes: 32 additions & 21 deletions classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -716,31 +716,13 @@ public static function admin_js() {
wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
wp_localize_script( 'formidable_settings', 'frmSettings', $settings_js_vars );

wp_register_script( 'formidable-web-components', $plugin_url . '/js/formidable-web-components.js', array( 'formidable_admin' ), $version, true );

Comment thread
Liviu-p marked this conversation as resolved.
if ( self::should_show_floating_links() ) {
self::enqueue_floating_links( $plugin_url, $version );
}

$dependencies = array(
'formidable_admin_global',
'jquery',
'jquery-ui-core',
'jquery-ui-draggable',
'jquery-ui-sortable',
'bootstrap_tooltip',
'bootstrap-multiselect',
'wp-i18n',
// Required in WP versions older than 5.7
'wp-hooks',
'formidable_dom',
'formidable_embed',
);

if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
// We only need to load the color picker when editing styles.
$dependencies[] = 'wp-color-picker';
}

wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true );
wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', self::get_admin_js_dependencies(), $version, true );

if ( FrmAppHelper::on_form_listing_page() ) {
// For the existing page dropdown in the Form embed modal.
Expand Down Expand Up @@ -827,6 +809,35 @@ public static function admin_js() {
self::enqueue_builder_assets( $plugin_url, $version );
}

/**
* @since x.x
*
* @return array
*/
private static function get_admin_js_dependencies() {
$dependencies = array(
'formidable_admin_global',
'jquery',
'jquery-ui-core',
'jquery-ui-draggable',
'jquery-ui-sortable',
'bootstrap_tooltip',
'bootstrap-multiselect',
'wp-i18n',
// Required in WP versions older than 5.7
'wp-hooks',
'formidable_dom',
'formidable_embed',
);

if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
// We only need to load the color picker when editing styles.
$dependencies[] = 'wp-color-picker';
}

return $dependencies;
}

/**
* Enqueue the Form Builder assets.
*
Expand Down
12 changes: 10 additions & 2 deletions classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1711,12 +1711,15 @@ public static function update_button_classes( $classes ) {
}

/**
* @since x.x Added $template_path parameter.
*
* @param int|string $form_id
* @param string $class
* @param string $template_path The path to a template file to use instead of the default.
*
* @return void
*/
public static function mb_tags_box( $form_id, $class = '' ) {
public static function mb_tags_box( $form_id, $class = '', $template_path = 'default' ) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
$fields = FrmField::get_all_for_form( $form_id, '', 'include' );

/**
Expand All @@ -1737,7 +1740,12 @@ public static function mb_tags_box( $form_id, $class = '' ) {

$advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );

include FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php';
if ( 'default' === $template_path || ! file_exists( $template_path ) ) {
include FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php';
return;
}

include $template_path;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion css/frm_admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/formidable-settings-components.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/formidable-web-components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/formidable_admin.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ window.frmAdminBuildJS = function() {
/**
* @since x.x
*
* @param {boolean} denyDropInRepeater
* @param {boolean} denyDropInRepeater
* @param {HTMLElement} draggable
*/
const shouldDenyDropInRepeater = wp.hooks.applyFilters( 'frm_deny_drop_in_repeater', false, draggable );
Expand Down Expand Up @@ -11270,6 +11270,7 @@ window.frmAdminBuildJS = function() {
handleAddFieldClickResponse,
syncLayoutClasses,
moveFieldSettings,
maybeCollapseSettings,
};
};

Expand Down
Loading