PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0-beta1
Elementor Website Builder – more than just a page builder v3.30.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/atomic-widgets/elements/atomic-youtube/atomic-youtube.php +8 -61 4.1.4 → 3.30.0-beta1 View file →
@@ -3,20 +3,16 @@
3 3
4 4 use Elementor\Modules\AtomicWidgets\Controls\Section;
5 5 use Elementor\Modules\AtomicWidgets\Controls\Types\Switch_Control;
6 6 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
7 -use Elementor\Modules\AtomicWidgets\DynamicTags\Dynamic_Prop_Type;
8 -use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base;
9 -use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template;
7 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
8 +use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
10 9 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
11 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
12 10 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Boolean_Prop_Type;
13 11 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
12 +use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
14 13 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
15 14 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
16 -use Elementor\Modules\AtomicWidgets\Elements\Loader\Frontend_Assets_Loader;
17 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
18 -use Elementor\Utils;
19 15
20 16 if ( ! defined( 'ABSPATH' ) ) {
21 17 exit; // Exit if accessed directly.
22 18 }
@@ -23,15 +19,8 @@
23 19
24 20 class Atomic_Youtube extends Atomic_Widget_Base {
25 21 use Has_Template;
26 22
27 - protected function get_css_id_control_meta(): array {
28 - return [
29 - 'layout' => 'two-columns',
30 - 'topDivider' => false,
31 - ];
32 - }
33 -
34 23 public static function get_element_type(): string {
35 24 return 'e-youtube';
36 25 }
37 26
@@ -54,10 +43,10 @@
54 43
55 44 'source' => String_Prop_Type::make()
56 45 ->default( 'https://www.youtube.com/watch?v=XHOmBV4js_E' ),
57 46
58 - 'start' => String_Prop_Type::make()->meta( Dynamic_Prop_Type::ignore() ),
59 - 'end' => String_Prop_Type::make()->meta( Dynamic_Prop_Type::ignore() ),
47 + 'start' => String_Prop_Type::make(),
48 + 'end' => String_Prop_Type::make(),
60 49 'autoplay' => Boolean_Prop_Type::make()->default( false ),
61 50 'mute' => Boolean_Prop_Type::make()->default( false ),
62 51 'loop' => Boolean_Prop_Type::make()->default( false ),
63 52 'lazyload' => Boolean_Prop_Type::make()->default( false ),
@@ -64,10 +53,8 @@
64 53 'player_controls' => Boolean_Prop_Type::make()->default( true ),
65 54 'captions' => Boolean_Prop_Type::make()->default( false ),
66 55 'privacy_mode' => Boolean_Prop_Type::make()->default( false ),
67 56 'rel' => Boolean_Prop_Type::make()->default( true ),
68 -
69 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
70 57 ];
71 58 }
72 59
73 60 protected function define_atomic_controls(): array {
@@ -75,10 +62,10 @@
75 62 Section::make()
76 63 ->set_label( __( 'Content', 'elementor' ) )
77 64 ->set_items( [
78 65 Text_Control::bind_to( 'source' )
79 - ->set_placeholder( esc_html__( 'Type or paste your URL', 'elementor' ) )
80 - ->set_label( esc_html__( 'YouTube URL', 'elementor' ) ),
66 + ->set_label( esc_html__( 'YouTube URL', 'elementor' ) )
67 + ->set_placeholder( esc_html__( 'Type or paste your URL', 'elementor' ) ),
81 68
82 69 Text_Control::bind_to( 'start' )->set_label( esc_html__( 'Start time', 'elementor' ) ),
83 70 Text_Control::bind_to( 'end' )->set_label( esc_html__( 'End time', 'elementor' ) ),
84 71 Switch_Control::bind_to( 'autoplay' )->set_label( esc_html__( 'Autoplay', 'elementor' ) ),
@@ -89,23 +76,11 @@
89 76 Switch_Control::bind_to( 'captions' )->set_label( esc_html__( 'Captions', 'elementor' ) ),
90 77 Switch_Control::bind_to( 'privacy_mode' )->set_label( esc_html__( 'Privacy mode', 'elementor' ) ),
91 78 Switch_Control::bind_to( 'rel' )->set_label( esc_html__( 'Related videos', 'elementor' ) ),
92 79 ] ),
93 - Section::make()
94 - ->set_label( __( 'Settings', 'elementor' ) )
95 - ->set_id( 'settings' )
96 - ->set_items( $this->get_settings_controls() ),
97 80 ];
98 81 }
99 82
100 - protected function get_settings_controls(): array {
101 - return [
102 - Text_Control::bind_to( '_cssid' )
103 - ->set_label( __( 'ID', 'elementor' ) )
104 - ->set_meta( $this->get_css_id_control_meta() ),
105 - ];
106 - }
107 -
108 83 protected function define_base_styles(): array {
109 84 return [
110 85 'base' => Style_Definition::make()
111 86 ->add_variant(
@@ -110,46 +85,18 @@
110 85 'base' => Style_Definition::make()
111 86 ->add_variant(
112 87 Style_Variant::make()
113 88 ->add_prop( 'aspect-ratio', String_Prop_Type::generate( '16/9' ) )
114 - ->add_prop( 'overflow', String_Prop_Type::generate( 'hidden' ) )
115 89 ),
116 90 ];
117 91 }
118 92
119 93 public function get_script_depends() {
120 - return array_merge(
121 - parent::get_script_depends(),
122 - [ 'elementor-youtube-handler' ],
123 - );
94 + return [ 'elementor-youtube-handler' ];
124 95 }
125 96
126 - public function register_frontend_handlers() {
127 - $assets_url = ELEMENTOR_ASSETS_URL;
128 - $min_suffix = ( Utils::is_script_debug() || Utils::is_elementor_tests() ) ? '' : '.min';
129 -
130 - wp_register_script(
131 - 'elementor-youtube-handler',
132 - "{$assets_url}js/youtube-handler{$min_suffix}.js",
133 - [ Frontend_Assets_Loader::FRONTEND_HANDLERS_HANDLE ],
134 - ELEMENTOR_VERSION,
135 - true
136 - );
137 - }
138 -
139 97 protected function get_templates(): array {
140 98 return [
141 99 'elementor/elements/atomic-youtube' => __DIR__ . '/atomic-youtube.html.twig',
142 100 ];
143 - }
144 -
145 - public function render_markdown(): string {
146 - $settings = $this->get_atomic_settings();
147 - $url = $settings['source'] ?? '';
148 -
149 - if ( empty( $url ) ) {
150 - return '';
151 - }
152 -
153 - return '[Video](' . esc_url( $url ) . ')';
154 101 }
155 102 }