| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Widgets; |
| 4 |
|
| 5 |
defined('ABSPATH') or die; |
| 6 |
|
| 7 |
use FluentForm\App\Modules\Widgets\FluentFormWidget; |
| 8 |
|
| 9 |
class ElementorWidget |
| 10 |
{ |
| 11 |
private $app = null; |
| 12 |
|
| 13 |
public function __construct($app) |
| 14 |
{ |
| 15 |
$this->app = $app; |
| 16 |
add_action('elementor/widgets/register', [$this, 'init_widgets']); |
| 17 |
} |
| 18 |
|
| 19 |
public function init_widgets($widgets_manager) |
| 20 |
{ |
| 21 |
$this->enqueueAssets(); |
| 22 |
|
| 23 |
if (file_exists(FLUENTFORM_DIR_PATH . 'app/Modules/Widgets/FluentFormWidget.php')) { |
| 24 |
require_once FLUENTFORM_DIR_PATH . 'app/Modules/Widgets/FluentFormWidget.php'; |
| 25 |
$widgets_manager->register(new FluentFormWidget()); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
public function enqueueAssets() |
| 30 |
{ |
| 31 |
wp_enqueue_style('fluentform-elementor-widget', fluentformMix('css/fluent-forms-elementor-widget.css'), [], FLUENTFORM_VERSION); |
| 32 |
wp_enqueue_script('fluentform-elementor', fluentformMix('js/fluent-forms-elementor-widget.js'), [], FLUENTFORM_VERSION, true); |
| 33 |
|
| 34 |
wp_localize_script('fluentform-elementor', 'fluentformElementor', [ |
| 35 |
'adminUrl' => admin_url('admin.php'), |
| 36 |
]); |
| 37 |
} |
| 38 |
} |
| 39 |
|