Description

The wpforms_builder_enqueues_before action fires in the form builder right before WPForms enqueues its own builder styles and scripts.

parametertypedescription
$viewstringCurrent builder view, taken from the view query argument and sanitized with sanitize_key(). Defaults to fields for an existing form and setup for a new form.

More Information

The action runs inside WPForms_Builder::enqueues(), which is hooked to admin_enqueue_scripts at PHP_INT_MAX priority. It fires after suppress_conflicts() has removed conflicting third-party assets and before any WPForms builder handle is registered, so handles such as wpforms-builder are not yet available as dependencies. Use wpforms_builder_enqueues when the callback depends on them.

The file ships in both Lite and Pro. $view matches the builder panel in the URL, for example fields, settings, payments or setup.

Source

wpforms/includes/admin/builder/class-builder.php

Example

This example enqueues a stylesheet on the builder Settings panel before WPForms loads its own assets, so any conflicting rule in the WPForms styles wins.

/**
 * Enqueue a stylesheet before the builder assets load.
 *
 * @link https://wpforms.com/developers/wpforms_builder_enqueues_before/
 *
 * @param string $view Current builder view.
 */
function wpf_dev_builder_enqueues_before( $view ) {

    // Only load on the Settings panel.
    if ( $view !== 'settings' ) {
        return;
    }

    wp_enqueue_style(
        'wpf-dev-builder-settings',
        get_stylesheet_directory_uri() . '/css/wpforms-builder-settings.css',
        [],
        '1.0.0'
    );
}
add_action( 'wpforms_builder_enqueues_before', 'wpf_dev_builder_enqueues_before', 10, 1 );