| 1 |
<?php |
| 2 |
/** |
| 3 |
* Page Builder. |
| 4 |
* |
| 5 |
* @package sureforms. |
| 6 |
* @since 0.0.5 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SRFM\Inc\Page_Builders; |
| 10 |
|
| 11 |
use SRFM\Inc\Page_Builders\Elementor\Service_Provider as Elementor_Service_Provider; |
| 12 |
use SRFM\Inc\Page_Builders\Bricks\Service_Provider as Bricks_Service_Provider; |
| 13 |
use SRFM\Inc\Traits\Get_Instance; |
| 14 |
use SRFM\Inc\Frontend_Assets; |
| 15 |
|
| 16 |
/** |
| 17 |
* Class to add SureForms widget in other page builders. |
| 18 |
*/ |
| 19 |
class Page_Builders { |
| 20 |
use Get_Instance; |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor |
| 24 |
* |
| 25 |
* Load all Page Builders form widgets. |
| 26 |
* |
| 27 |
* @since 0.0.5 |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function __construct() { |
| 31 |
Elementor_Service_Provider::get_instance(); |
| 32 |
Bricks_Service_Provider::get_instance(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Enqueue common fields assets for the dropdown and phone fields. |
| 37 |
* |
| 38 |
* @since 0.0.10 |
| 39 |
* @return void |
| 40 |
*/ |
| 41 |
public static function enqueue_common_fields_assets() { |
| 42 |
$file_prefix = defined( 'SRFM_DEBUG' ) && SRFM_DEBUG ? '' : '.min'; |
| 43 |
$dir_name = defined( 'SRFM_DEBUG' ) && SRFM_DEBUG ? 'unminified' : 'minified'; |
| 44 |
$js_uri = SRFM_URL . 'assets/js/' . $dir_name . '/blocks/'; |
| 45 |
$js_vendor_uri = SRFM_URL . 'assets/js/minified/deps/'; |
| 46 |
|
| 47 |
wp_enqueue_script( SRFM_SLUG . '-phone', $js_uri . 'phone' . $file_prefix . '.js', [], SRFM_VER, true ); |
| 48 |
wp_enqueue_script( SRFM_SLUG . '-phone-intl-input-deps', $js_vendor_uri . 'intl/intTelInput.min.js', [], SRFM_VER, true ); |
| 49 |
wp_enqueue_script( SRFM_SLUG . '-phone-intl-utils-deps', $js_vendor_uri . 'intl/intTelUtils.min.js', [], SRFM_VER, true ); |
| 50 |
|
| 51 |
wp_enqueue_script( SRFM_SLUG . '-dropdown', $js_uri . 'dropdown' . $file_prefix . '.js', [], SRFM_VER, true ); |
| 52 |
wp_enqueue_script( SRFM_SLUG . '-tom-select', $js_vendor_uri . 'tom-select.min.js', [], SRFM_VER, true ); |
| 53 |
|
| 54 |
if ( defined( 'SRFM_PRO_VER' ) && defined( 'SRFM_PRO_URL' ) && defined( 'SRFM_PRO_SLUG' ) ) { |
| 55 |
$css_uri = SRFM_PRO_URL . 'assets/css/' . $dir_name . '/'; |
| 56 |
|
| 57 |
wp_enqueue_style( SRFM_PRO_SLUG . '-frontend-default', $css_uri . '/blocks/default/frontend' . $file_prefix . '.css', [], SRFM_PRO_VER ); |
| 58 |
} |
| 59 |
|
| 60 |
Frontend_Assets::enqueue_scripts_and_styles(); |
| 61 |
} |
| 62 |
|
| 63 |
} |
| 64 |
|