);
$this->add_control(
- 'url_video',
+ 'video',
[
- 'label' => __('Video embed url', 'cube'),
- 'type' => Controls_Manager::URL,
- 'default' => [
- 'url' => '',
- 'is_external' => false,
- ],
- 'show_external' => false
+ 'label' => esc_html__( 'Has video', 'textdomain' ),
+ 'type' => \Elementor\Controls_Manager::SWITCHER,
+ 'label_on' => esc_html__( 'Yes', 'textdomain' ),
+ 'label_off' => esc_html__( 'No', 'textdomain' ),
+ 'return_value' => 'yes',
+ 'default' => 'no',
]
);
$body_image = $this->get_settings('body_image');
$cta_text = $this->get_settings('cta_text');
$cta_link = $this->get_settings('cta_link');
- $url_video = $this->get_settings('url_video');
+ $video = $this->get_settings('video');
if ( ! empty( $cta_link['url'] ) ) {
$this->add_render_attribute( 'cta_text', 'href', $cta_link['url'] );
<?= wp_get_attachment_image($body_image['id'], 'full', false, ['class' => 'hero-block-body-image']); ?>
<?php endif; ?>
- <?php if (!empty($url_video['url'])): ?>
+ <?php if ($video === 'yes'): ?>
<div class="hero-block-player-button">
<?= \App\svg_image('player', 'svg player-button')->toHtml(); ?>
</div>