PluginProbe
Elementor Website Builder – more than just a page builder / 3.22.0-dev4
Elementor Website Builder – more than just a page builder v3.22.0-dev4
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / promotions / widgets / pro-widget-promotion.php

pro-widget-promotion.php in Elementor Website Builder – more than just a page builder 3.22.0-dev4, at modules/promotions/widgets/pro-widget-promotion.php

92 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Promotions\Widgets;
3
4 use Elementor\Widget_Base;
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10 class Pro_Widget_Promotion extends Widget_Base {
11
12 private $widget_data;
13
14 public function hide_on_search() {
15 return true;
16 }
17
18 public function show_in_panel() {
19 return false;
20 }
21
22 public function get_name() {
23 return $this->widget_data['widget_name'];
24 }
25
26 public function get_title() {
27 return $this->widget_data['widget_title'];
28 }
29
30 public function on_import( $element ) {
31 $element['settings']['__should_import'] = true;
32
33 return $element;
34 }
35
36 protected function register_controls() {}
37
38 protected function render() {
39 if ( $this->is_editor_render() ) {
40 $this->render_promotion();
41 } else {
42 $this->render_empty_content();
43 }
44 }
45
46 private function is_editor_render(): bool {
47 return \Elementor\Plugin::$instance->editor->is_edit_mode();
48 }
49
50 private function render_promotion() {
51 ?>
52 <div class="e-container">
53 <span class="e-badge"><i class="eicon-lock" aria-hidden="true"></i> <?php echo esc_html__( 'Pro', 'elementor' ); ?></span>
54 <p>
55 <img src="<?php echo esc_url( $this->get_promotion_image_url() ); ?>" loading="lazy" alt="Go Pro">
56 <?php
57 echo sprintf(
58 esc_html__( 'This result includes the Elementor Pro %s widget. Upgrade now to unlock it and grow your web creation toolkit.', 'elementor' ),
59 esc_html( $this->widget_data['widget_title'] )
60 );
61 ?>
62 </p>
63 <div class="e-actions">
64 <a href="#" class="e-btn e-btn-txt e-promotion-delete"><?php echo esc_html__( 'Remove', 'elementor' ); ?></a>
65 <a href="https://go.elementor.com/go-pro-element-pro/" rel="noreferrer" target="_blank" class="e-btn go-pro elementor-clickable e-promotion-go-pro"><?php echo esc_html__( 'Go Pro', 'elementor' ); ?></a>
66 </div>
67 </div>
68 <?php
69 }
70
71 private function get_promotion_image_url(): string {
72 return ELEMENTOR_ASSETS_URL . 'images/go-pro.svg';
73 }
74
75 private function render_empty_content() {
76 echo ' ';
77 }
78
79 protected function content_template() {}
80
81 public function __construct( $data = [], $args = null ) {
82 $this->widget_data = [
83 'widget_name' => $args['widget_name'],
84 'widget_title' => $args['widget_title'],
85 ];
86
87 parent::__construct( $data, $args );
88 }
89
90 public function render_plain_content( $instance = [] ) {}
91 }
92