: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/* global WPForms, jQuery, Map, wpforms_builder, wpforms_builder_providers, _ */
var WPForms = window.WPForms || {};
WPForms.Admin = WPForms.Admin || {};
WPForms.Admin.Builder = WPForms.Admin.Builder || {};
WPForms.Admin.Builder.Templates = WPForms.Admin.Builder.Templates || ( function( document, window, $ ) {
* Private functions and properties.
* All templating functions for providers are stored here in a Map.
* Key is a template name, value - Underscore.js templating function.
* Public functions and properties.
* Start the engine. DOM is not ready yet, use only to init something.
// Do that when DOM is ready.
$( '#wpforms-panel-providers' ).trigger( 'WPForms.Admin.Builder.Templates.ready' );
* Register and compile all templates.
* All data is saved in a Map.
* @param {string[]} templates Array of template names.
add: function( templates ) {
templates.forEach( function( template ) {
if ( typeof template === 'string' ) {
__private.previews.set( template, wp.template( template ) );
* Get a templating function (to compile later with data).
* @param {string} template ID of a template to retrieve from a cache.
* @returns {*} A callable that after compiling will always return a string.
get: function( template ) {
var preview = __private.previews.get( template );
if ( typeof preview !== 'undefined' ) {
// Provide access to public functions/properties.
} )( document, window, jQuery );
WPForms.Admin.Builder.Templates.init();