| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -namespace Easyel\EasyElements\Widgets; | |
| 3 | 2 | use Elementor\Controls_Manager; |
| 4 | 3 | use Elementor\Widget_Base; |
| 5 | 4 | |
| 6 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -7,8 +6,19 @@ | ||
| 7 | 6 | exit; |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | 9 | class Easyel_Button_Widget extends \Elementor\Widget_Base { |
| 10 | + | |
| 11 | + public function get_style_depends() { | |
| 12 | + $handle = 'eel-button-style'; | |
| 13 | + $css_path = plugin_dir_path( __FILE__ ) . 'css/button.min.css'; | |
| 14 | + | |
| 15 | + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { | |
| 16 | + wp_register_style( $handle, plugins_url( 'css/button.min.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : EASYELEMENTS_VER ); | |
| 17 | + } | |
| 18 | + return [ $handle ]; | |
| 19 | + } | |
| 20 | + | |
| 11 | 21 | public function get_name() { |
| 12 | 22 | return 'eel-button'; |
| 13 | 23 | } |
| 14 | 24 | |
| @@ -26,14 +36,8 @@ | ||
| 26 | 36 | |
| 27 | 37 | public function get_keywords() { |
| 28 | 38 | return [ 'button', 'link', 'click', 'text' ]; |
| 29 | 39 | } |
| 30 | - | |
| 31 | - public function get_style_depends() { | |
| 32 | - return [ | |
| 33 | - 'eel-button', | |
| 34 | - ]; | |
| 35 | - } | |
| 36 | 40 | |
| 37 | 41 | protected function register_controls() { |
| 38 | 42 | |
| 39 | 43 | $this->start_controls_section( |