PluginProbe
Elementor Website Builder – more than just a page builder / 3.22.2
Elementor Website Builder – more than just a page builder v3.22.2
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/video.php +23 -56 4.2.23.22.2 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 4 use Elementor\Modules\DynamicTags\Module as TagsModule;
5 -use Elementor\Modules\Promotions\Controls\Promotion_Control;
6 5
7 6 if ( ! defined( 'ABSPATH' ) ) {
8 7 exit; // Exit if accessed directly.
9 8 }
@@ -93,26 +92,8 @@
93 92 return false;
94 93 }
95 94
96 95 /**
97 - * Get style dependencies.
98 - *
99 - * Retrieve the list of style dependencies the widget requires.
100 - *
101 - * @since 3.24.0
102 - * @access public
103 - *
104 - * @return array Widget style dependencies.
105 - */
106 - public function get_style_depends(): array {
107 - return [ 'widget-video' ];
108 - }
109 -
110 - public function has_widget_inner_wrapper(): bool {
111 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
112 - }
113 -
114 - /**
115 96 * Register video widget controls.
116 97 *
117 98 * Adds different input fields to allow the user to change and customize the widget settings.
118 99 *
@@ -358,16 +339,23 @@
358 339 $this->add_control(
359 340 'autoplay',
360 341 [
361 342 'label' => esc_html__( 'Autoplay', 'elementor' ),
362 - 'description' => sprintf(
363 - /* translators: 1: `<a>` opening tag, 2: `</a>` closing tag. */
364 - esc_html__( 'Note: Autoplay is affected by %1$s Google’s Autoplay policy %2$s on Chrome browsers.', 'elementor' ),
365 - '<a href="https://developers.google.com/web/updates/2017/09/autoplay-policy-changes" target="_blank">',
366 - '</a>'
367 - ),
368 343 'type' => Controls_Manager::SWITCHER,
369 344 'frontend_available' => true,
345 + 'conditions' => [
346 + 'relation' => 'or',
347 + 'terms' => [
348 + [
349 + 'name' => 'show_image_overlay',
350 + 'value' => '',
351 + ],
352 + [
353 + 'name' => 'image_overlay[url]',
354 + 'value' => '',
355 + ],
356 + ],
357 + ],
370 358 ]
371 359 );
372 360
373 361 $this->add_control(
@@ -432,11 +420,11 @@
432 420 ]
433 421 );
434 422
435 423 $this->add_control(
436 - 'cc_load_policy',
424 + 'modestbranding',
437 425 [
438 - 'label' => esc_html__( 'Captions', 'elementor' ),
426 + 'label' => esc_html__( 'Modest Branding', 'elementor' ),
439 427 'type' => Controls_Manager::SWITCHER,
440 428 'condition' => [
441 429 'video_type' => [ 'youtube' ],
442 430 'controls' => 'yes',
@@ -957,9 +945,9 @@
957 945 'default' => [
958 946 'unit' => '%',
959 947 ],
960 948 // 'selectors' => [
961 - // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};',
949 + // '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};',
962 950 // ],
963 951 'condition' => [
964 952 'lightbox_video_width!' => '',
965 953 'lightbox_content_position!' => '',
@@ -978,9 +966,9 @@
978 966 '' => esc_html__( 'Center', 'elementor' ),
979 967 'top' => esc_html__( 'Top', 'elementor' ),
980 968 ],
981 969 // 'selectors' => [
982 - // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);',
970 + // '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);',
983 971 // ],
984 972 'selectors_dictionary' => [
985 973 'top' => 'top: 60px',
986 974 ],
@@ -1048,9 +1036,9 @@
1048 1036
1049 1037 if ( $is_static_render_mode ) {
1050 1038 $video_html = Embed::get_embed_thumbnail_html( $video_url, $post_id );
1051 1039 // YouTube API requires a different markup which was set above.
1052 - } elseif ( 'youtube' !== $settings['video_type'] ) {
1040 + } else if ( 'youtube' !== $settings['video_type'] ) {
1053 1041 $video_html = Embed::get_embed_html( $video_url, $embed_params, $embed_options );
1054 1042 }
1055 1043 }
1056 1044
@@ -1083,15 +1071,14 @@
1083 1071 $lightbox_options = [
1084 1072 'type' => 'video',
1085 1073 'videoType' => $settings['video_type'],
1086 1074 'url' => $lightbox_url,
1087 - 'autoplay' => $settings['autoplay'],
1088 1075 'modalOptions' => [
1089 1076 'id' => 'elementor-lightbox-' . $this->get_id(),
1090 1077 'entranceAnimation' => $settings['lightbox_content_animation'],
1091 1078 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'],
1092 1079 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'],
1093 - 'videoAspectRatio' => $settings['aspect_ratio'] ?? '169',
1080 + 'videoAspectRatio' => $settings['aspect_ratio'],
1094 1081 ],
1095 1082 ];
1096 1083
1097 1084 if ( 'hosted' === $settings['video_type'] ) {
@@ -1134,8 +1121,9 @@
1134 1121 ];
1135 1122 }
1136 1123 Icons_Manager::render_icon( $settings['play_icon'], [ 'aria-hidden' => 'true' ] );
1137 1124 ?>
1125 + <span class="elementor-screen-only"><?php $this->print_a11y_text( $settings['image_overlay'] ); ?></span>
1138 1126 </div>
1139 1127 <?php endif; ?>
1140 1128 </div>
1141 1129 <?php } ?>
@@ -1145,9 +1133,9 @@
1145 1133
1146 1134 /**
1147 1135 * Render video widget as plain content.
1148 1136 *
1149 - * Override the default behavior, by printing the video URL instead of rendering it.
1137 + * Override the default behavior, by printing the video URL insted of rendering it.
1150 1138 *
1151 1139 * @since 1.4.5
1152 1140 * @access public
1153 1141 */
@@ -1193,9 +1181,9 @@
1193 1181 'loop',
1194 1182 'controls',
1195 1183 'mute',
1196 1184 'rel',
1197 - 'cc_load_policy',
1185 + 'modestbranding',
1198 1186 ];
1199 1187
1200 1188 if ( $settings['loop'] ) {
1201 1189 $video_properties = Embed::get_video_properties( $settings['youtube_url'] );
@@ -1332,8 +1320,9 @@
1332 1320 return $video_params;
1333 1321 }
1334 1322
1335 1323 /**
1324 + * @param bool $from_media
1336 1325 *
1337 1326 * @return string
1338 1327 * @since 2.1.0
1339 1328 * @access private
@@ -1411,28 +1400,6 @@
1411 1400 /* Sometimes the video url is base64, therefore we use `esc_attr` in `src`. */
1412 1401 ?>
1413 1402 <video class="elementor-video" src="<?php echo esc_attr( $video_url ); ?>" <?php Utils::print_html_attributes( $video_params ); ?>></video>
1414 1403 <?php
1415 - }
1416 -
1417 - public function render_markdown(): string {
1418 - $settings = $this->get_settings_for_display();
1419 - $video_type = $settings['video_type'] ?? 'youtube';
1420 - $url = '';
1421 -
1422 - if ( 'hosted' === $video_type ) {
1423 - if ( ! empty( $settings['insert_url'] ) ) {
1424 - $url = $settings['external_url']['url'] ?? '';
1425 - } else {
1426 - $url = $settings['hosted_url']['url'] ?? '';
1427 - }
1428 - } else {
1429 - $url = $settings[ $video_type . '_url' ] ?? '';
1430 - }
1431 -
1432 - if ( empty( $url ) ) {
1433 - return '';
1434 - }
1435 -
1436 - return '[Video](' . esc_url( $url ) . ')';
1437 1404 }
1438 1405 }