| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Widgets; |
| 4 |
use Elementor\Plugin as Elementor; |
| 5 |
use FluentForm\App\Modules\Widgets\FluentFormWidget; |
| 6 |
|
| 7 |
class ElementorWidget |
| 8 |
{ |
| 9 |
private $app = null; |
| 10 |
|
| 11 |
public function __construct($app) |
| 12 |
{ |
| 13 |
$this->app = $app; |
| 14 |
add_action( 'elementor/widgets/widgets_registered', array($this, 'init_widgets') ); |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
public function init_widgets() |
| 19 |
{ |
| 20 |
$this->enqueueAssets(); |
| 21 |
|
| 22 |
$widgets_manager = Elementor::instance()->widgets_manager; |
| 23 |
|
| 24 |
if ( file_exists( FLUENTFORM_DIR_PATH.'app/Modules/Widgets/FluentFormWidget.php' ) ) { |
| 25 |
require_once FLUENTFORM_DIR_PATH.'app/Modules/Widgets/FluentFormWidget.php'; |
| 26 |
$widgets_manager->register_widget_type( new FluentFormWidget() ); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
public function enqueueAssets() |
| 32 |
{ |
| 33 |
wp_enqueue_style('fluentform-elementor-widget', $this->app->publicUrl('css/fluent-forms-elementor-widget.css'), array(), FLUENTFORM_VERSION ); |
| 34 |
} |
| 35 |
|
| 36 |
} |
| 37 |
|