PluginProbe
Elementor Website Builder – more than just a page builder / 3.26.2
Elementor Website Builder – more than just a page builder v3.26.2
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 4.0.7 All 451 releases
← All changes | modules/announcements/module.php +34 -1 4.2.03.26.2 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Elementor\Modules\Announcements;
4 4
5 5 use Elementor\Core\Base\App as BaseApp;
6 +use Elementor\Modules\Ai\Preferences;
6 7 use Elementor\Modules\Announcements\Classes\Announcement;
7 8 use Elementor\Settings as ElementorSettings;
8 9
9 10 if ( ! defined( 'ABSPATH' ) ) {
@@ -64,9 +65,9 @@
64 65 $additional_settings = [];
65 66
66 67 foreach ( $active_announcements as $announcement ) {
67 68 $additional_settings[] = $announcement->get_prepared_data();
68 - // @TODO - replace with ajax request from the front after actually triggered
69 + //@TODO - replace with ajax request from the front after actually triggered
69 70 $announcement->after_triggered();
70 71 }
71 72
72 73 return [
@@ -93,10 +94,42 @@
93 94 */
94 95 private function get_raw_announcements(): array {
95 96 $raw_announcements = [];
96 97
98 + if ( Preferences::is_ai_enabled( get_current_user_id() ) ) {
99 + $raw_announcements[] = $this->get_ai_announcement_data();
100 + }
101 +
97 102 // DO NOT USE THIS FILTER
98 103 return apply_filters( 'elementor/announcements/raw_announcements', $raw_announcements );
104 + }
105 +
106 + private function get_ai_announcement_data(): array {
107 + return [
108 + 'title' => __( 'Discover your new superpowers ', 'elementor' ),
109 + 'description' => __( '<p>With AI for text, code, image generation and editing, you can bring your vision to life faster than ever. Start your free trial now - <b>no credit card required!</b></p>', 'elementor' ),
110 + 'media' => [
111 + 'type' => 'image',
112 + 'src' => ELEMENTOR_ASSETS_URL . 'images/announcement.png?' . ELEMENTOR_VERSION,
113 + ],
114 + 'cta' => [
115 + [
116 + 'label' => __( 'Let\'s do it', 'elementor' ),
117 + 'variant' => 'primary',
118 + 'target' => '_top',
119 + 'url' => '#welcome-ai',
120 + ],
121 + [
122 + 'label' => __( 'Skip', 'elementor' ),
123 + 'variant' => 'secondary',
124 + ],
125 + ],
126 + 'triggers' => [
127 + [
128 + 'action' => 'aiStarted',
129 + ],
130 + ],
131 + ];
99 132 }
100 133
101 134 /**
102 135 * Retrieve all announcement objects.