| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Notes; |
| 3 |
|
| 4 |
use Elementor\Core\Base\Module as BaseModule; |
| 5 |
use Elementor\Utils; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly. |
| 9 |
} |
| 10 |
|
| 11 |
class Module extends BaseModule { |
| 12 |
|
| 13 |
public function get_name() { |
| 14 |
return 'notes'; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Enqueue the module scripts. |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function enqueue_scripts() { |
| 23 |
wp_enqueue_script( |
| 24 |
'elementor-notes', |
| 25 |
$this->get_js_assets_url( 'notes' ), |
| 26 |
[ 'elementor-editor' ], |
| 27 |
ELEMENTOR_VERSION, |
| 28 |
true |
| 29 |
); |
| 30 |
|
| 31 |
wp_set_script_translations( 'elementor-notes', 'elementor' ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Enqueue the module styles. |
| 36 |
* |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function enqueue_styles() { |
| 40 |
wp_enqueue_style( |
| 41 |
'elementor-notes', |
| 42 |
$this->get_css_assets_url( 'modules/notes/editor' ), |
| 43 |
[ 'elementor-editor' ], |
| 44 |
ELEMENTOR_VERSION |
| 45 |
); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* @return bool |
| 50 |
*/ |
| 51 |
public static function is_active() { |
| 52 |
return ! Utils::has_pro(); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Initialize the Notes module. |
| 57 |
* |
| 58 |
* @return void |
| 59 |
*/ |
| 60 |
public function __construct() { |
| 61 |
parent::__construct(); |
| 62 |
|
| 63 |
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); |
| 64 |
add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_styles' ] ); |
| 65 |
} |
| 66 |
} |
| 67 |
|