PluginProbe
Elementor Website Builder – more than just a page builder / 3.20.0-dev3
Elementor Website Builder – more than just a page builder v3.20.0-dev3
4.3.2 4.3.1 4.3.0 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 All 455 releases
← All changes | modules/promotions/admin-menu-items/base-promotion-template.php +32 -12 4.3.0 → 3.20.0-dev3 View file →
@@ -2,35 +2,35 @@
2 2
3 3 namespace Elementor\Modules\Promotions\AdminMenuItems;
4 4
5 5 use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page;
6 -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
6 +use Elementor\Core\Utils\Promotions\Validate_Promotion;
7 7 use Elementor\Settings;
8 8 use Elementor\Utils;
9 9
10 10 if ( ! defined( 'ABSPATH' ) ) {
11 - exit; // Exit if accessed directly.
11 + exit; // Exit if accessed directly
12 12 }
13 13
14 14 abstract class Base_Promotion_Template implements Admin_Menu_Item_With_Page {
15 15
16 - abstract protected function get_promotion_title(): string;
16 + abstract protected function get_promotion_title():string;
17 17
18 - abstract protected function get_cta_url(): string;
18 + abstract protected function get_cta_url():string;
19 19
20 - abstract protected function get_content_lines(): array;
20 + abstract protected function get_content_lines():array;
21 21
22 - abstract protected function get_video_url(): string;
22 + abstract protected function get_video_url():string;
23 23
24 - public function is_visible(): bool {
24 + public function is_visible() {
25 25 return true;
26 26 }
27 27
28 - public function get_parent_slug(): string {
28 + public function get_parent_slug() {
29 29 return Settings::PAGE_ID;
30 30 }
31 31
32 - public function get_capability(): string {
32 + public function get_capability() {
33 33 return 'manage_options';
34 34 }
35 35
36 36 protected function get_cta_text() {
@@ -38,12 +38,11 @@
38 38 }
39 39
40 40 /**
41 41 * Should the promotion have a side note.
42 - *
43 42 * @return string
44 43 */
45 - protected function get_side_note(): string {
44 + protected function get_side_note():string {
46 45 return '';
47 46 }
48 47
49 48 private function get_lines() {
@@ -90,9 +89,15 @@
90 89 /**
91 90 * @return array|null
92 91 */
93 92 private function get_promotion_data(): ?array {
94 - return Filtered_Promotions_Manager::get_filtered_promotion_data( $this->build_promotion_data_array(), 'elementor/' . $this->get_name() . '/custom_promotion', 'cta_url' );
93 + $promotion_data = $this->build_promotion_data_array();
94 +
95 + $new_promotion_data = apply_filters( 'elementor/' . $this->get_name() . '/custom_promotion', $promotion_data );
96 +
97 + return count( $new_promotion_data ) <= count( $promotion_data )
98 + ? $this->replace_values( $promotion_data, $new_promotion_data )
99 + : $promotion_data;
95 100 }
96 101
97 102 /**
98 103 * @return array
@@ -105,6 +110,21 @@
105 110 'video_url' => $this->get_video_url(),
106 111 'lines' => $this->get_lines(),
107 112 'side_note' => $this->get_side_note(),
108 113 ];
114 + }
115 +
116 + /**
117 + * @param array $promotion_data
118 + * @param array $new_promotion_data
119 + * @return array
120 + */
121 + private function replace_values( array $promotion_data, array $new_promotion_data ): array {
122 + $new_promotion_data = array_replace( $promotion_data, $new_promotion_data );
123 +
124 + if ( ! Validate_Promotion::domain_is_on_elementor_dot_com( $new_promotion_data['cta_url'] ) ) {
125 + $new_promotion_data['cta_url'] = $promotion_data['cta_url'];
126 + }
127 +
128 + return $new_promotion_data;
109 129 }
110 130 }