Widget_Video::render()
Render video widget output on the frontend.
Description
Written in PHP and used to generate the final HTML.
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
Source
includes/widgets/video.php
], 'selectors' => [ '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'lightbox_content_position', [ 'label' => __( 'Content Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'frontend_available' => true, 'options' => [ '' => __( 'Center', 'elementor' ), 'top' => __( 'Top', 'elementor' ), ], 'selectors' => [ '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', ], 'selectors_dictionary' => [ 'top' => 'top: 60px', ], ] ); $this->add_control( 'lightbox_content_animation', [ 'label' => __( 'Entrance Animation', 'elementor' ), 'type' => Controls_Manager::ANIMATION, 'default' => '', 'frontend_available' => true, 'label_block' => true, ] ); $this->end_controls_section(); } /** * Render video widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_active_settings(); $video_link = 'youtube' === $settings['video_type'] ? $settings['link'] : $settings['vimeo_link']; if ( empty( $video_link ) ) { return; } $embed_params = $this->get_embed_params(); $embed_options = [ 'privacy' => $settings['yt_privacy'], ]; $video_html = Embed::get_embed_html( $video_link, $embed_params, $embed_options ); if ( empty( $video_html ) ) { echo esc_url( $video_link ); return; } $this->add_render_attribute( 'video-wrapper', 'class', 'elementor-wrapper' ); if ( ! $settings['lightbox'] ) { $this->add_render_attribute( 'video-wrapper', 'class', 'elementor-fit-aspect-ratio' ); }
Uses
- includes/widgets/video.php: Widget_Video::get_embed_options()
- includes/widgets/video.php: Widget_Video::render_hosted_video()
- includes/widgets/video.php: Widget_Video::get_hosted_video_url()
- includes/embed.php: Embed::get_embed_url()
- includes/embed.php: Embed::get_embed_html()
- includes/widgets/video.php: Widget_Video::has_image_overlay()
- includes/widgets/video.php: Widget_Video::get_hosted_params()
- includes/widgets/video.php: Widget_Video::get_embed_params()
- includes/controls/groups/image-size.php: Group_Control_Image_Size::get_attachment_image_html()
- includes/controls/groups/image-size.php: Group_Control_Image_Size::get_attachment_image_src() Show 5 more uses