| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Widgets; |
| 4 |
|
| 5 |
use Elementor\Plugin as Elementor; |
| 6 |
use FluentForm\App\Modules\Widgets\FluentFormWidget; |
| 7 |
|
| 8 |
class ElementorWidget |
| 9 |
{ |
| 10 |
private $app = null; |
| 11 |
|
| 12 |
public function __construct($app) |
| 13 |
{ |
| 14 |
$this->app = $app; |
| 15 |
add_action('elementor/widgets/register', [$this, 'init_widgets']); |
| 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(new FluentFormWidget()); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
public function enqueueAssets() |
| 31 |
{ |
| 32 |
wp_enqueue_style('fluentform-elementor-widget', $this->app->publicUrl('css/fluent-forms-elementor-widget.css'), [], FLUENTFORM_VERSION); |
| 33 |
} |
| 34 |
} |
| 35 |
|