From 0a4feddae16227affd9d166e7b5bbf8fa68d38f6 Mon Sep 17 00:00:00 2001 From: Akash Date: Sun, 10 Dec 2023 09:18:58 +0600 Subject: [PATCH] updated label --- .../Classes/Extend_Elementor_Controls.php | 35 +++++++++++++++++-- EmbedPress/Includes/Classes/Helper.php | 11 +++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/EmbedPress/Includes/Classes/Extend_Elementor_Controls.php b/EmbedPress/Includes/Classes/Extend_Elementor_Controls.php index 546ddf69..ec37649a 100644 --- a/EmbedPress/Includes/Classes/Extend_Elementor_Controls.php +++ b/EmbedPress/Includes/Classes/Extend_Elementor_Controls.php @@ -58,12 +58,41 @@ public function extend_elementor_share_and_lock_controls($that, $infix = '', $pr $that->add_control( 'adFileUrl', [ - 'label' => __('Ad File URL', 'embedpress'), + 'label' => __('Uploaded Video', 'embedpress'), 'type' => \Elementor\Controls_Manager::MEDIA, 'media_types' => [ - 'image', 'video' + 'video' + ], + 'condition' => [ + 'adManager' => 'yes', + 'adSource' => 'video', + ], + 'ai' => $ai_condition, + ] + ); + $that->add_control( + 'adFileUrl1', + [ + 'label' => __('Uploaded Image', 'embedpress'), + 'type' => \Elementor\Controls_Manager::MEDIA, + 'media_types' => [ + 'image' + ], + 'condition' => [ + 'adManager' => 'yes', + 'adSource' => 'image', + ], + 'ai' => $ai_condition, + ] + ); + $that->add_control( + 'adFileUrl2', + [ + 'type' => \Elementor\Controls_Manager::URL, + 'condition' => [ + 'adManager' => 'yes', + 'adSource' => 'url', ], - 'condition' => $ad_condition, 'ai' => $ai_condition, ] ); diff --git a/EmbedPress/Includes/Classes/Helper.php b/EmbedPress/Includes/Classes/Helper.php index 533b300a..8f0e429a 100644 --- a/EmbedPress/Includes/Classes/Helper.php +++ b/EmbedPress/Includes/Classes/Helper.php @@ -761,7 +761,16 @@ public static function generateAdTemplate($client_id, $attributes, $editor = 'el $adContent = isset($attributes['adContent']) ? $attributes['adContent'] : ''; if ($editor === 'elementor') { - $adFileUrl = isset($attributes['adFileUrl']['url']) ? $attributes['adFileUrl']['url'] : ''; + if($attributes['adSource'] === 'video'){ + $adFileUrl = isset($attributes['adFileUrl']['url']) ? $attributes['adFileUrl']['url'] : ''; + } + else if($attributes['adSource'] === 'image'){ + $adFileUrl = isset($attributes['adFileUrl1']['url']) ? $attributes['adFileUrl1']['url'] : ''; + } + else{ + $adFileUrl = isset($attributes['adFileUrl2']['url']) ? $attributes['adFileUrl2']['url'] : ''; + } + $width = isset($attributes['width']) ? $attributes['width']['size'] : '600'; $height = isset($attributes['height']) ? $attributes['height']['size'] : '550'; } else {