| @@ -1,10 +1,32 @@ | ||
| 1 | 1 | <?php |
| 2 | -namespace Easyel\EasyElements\Widgets; | |
| 3 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | 3 | exit; |
| 5 | 4 | } |
| 6 | 5 | class Easyel_Tab_Widget extends \Elementor\Widget_Base { |
| 6 | + | |
| 7 | + public function get_style_depends() { | |
| 8 | + $handle = 'eel-tab-style'; | |
| 9 | + $css_path = plugin_dir_path( __FILE__ ) . 'css/tab.css'; | |
| 10 | + | |
| 11 | + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { | |
| 12 | + wp_register_style( $handle, plugins_url( 'css/tab.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : '1.0.0' ); | |
| 13 | + } | |
| 14 | + return [ $handle ]; | |
| 15 | + } | |
| 16 | + | |
| 17 | + | |
| 18 | + public function get_script_depends() { | |
| 19 | + $handle = 'eel-tab-script'; | |
| 20 | + $js_path = plugin_dir_path( __FILE__ ) . 'js/tab.js'; | |
| 21 | + | |
| 22 | + if ( ! wp_script_is( $handle, 'registered' ) && file_exists( $js_path ) ) { | |
| 23 | + wp_enqueue_script( $handle, plugins_url( 'js/tab.js', __FILE__ ), [ 'jquery' ], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $js_path ) : '1.0.0', true ); | |
| 24 | + | |
| 25 | + } | |
| 26 | + return [ $handle ]; | |
| 27 | + } | |
| 28 | + | |
| 7 | 29 | public function get_name() { |
| 8 | 30 | return 'eel-tab'; |
| 9 | 31 | } |
| 10 | 32 | |
| @@ -22,20 +44,8 @@ | ||
| 22 | 44 | |
| 23 | 45 | public function get_keywords() { |
| 24 | 46 | return [ 'tab', 'link', 'click', 'text' ]; |
| 25 | 47 | } |
| 26 | - | |
| 27 | - public function get_style_depends() { | |
| 28 | - return [ | |
| 29 | - 'eel-tab', | |
| 30 | - ]; | |
| 31 | - } | |
| 32 | - | |
| 33 | - public function get_script_depends() { | |
| 34 | - return [ | |
| 35 | - 'eel-tab', | |
| 36 | - ]; | |
| 37 | - } | |
| 38 | 48 | |
| 39 | 49 | protected function register_controls() { |
| 40 | 50 | |
| 41 | 51 | $this->start_controls_section( |
| @@ -793,9 +803,9 @@ | ||
| 793 | 803 | $item['tab_image']['url'] |
| 794 | 804 | ) |
| 795 | 805 | ); |
| 796 | 806 | } |
| 797 | - } | |
| 807 | + } | |
| 798 | 808 | echo '<span class="ee-tab-title-text">' . esc_html( $item['tab_title'] ) . '</span>'; |
| 799 | 809 | echo '</li>'; |
| 800 | 810 | } |
| 801 | 811 | echo '</ul>'; |
| @@ -824,4 +834,5 @@ | ||
| 824 | 834 | echo '</div>'; |
| 825 | 835 | } |
| 826 | 836 | } |
| 827 | 837 | } |
| 838 | +?> | |