| @@ -41,17 +41,13 @@ | ||
| 41 | 41 | private function enqueue_scripts() { |
| 42 | 42 | wp_enqueue_script( |
| 43 | 43 | 'announcements-app', |
| 44 | 44 | $this->get_js_assets_url( 'announcements-app' ), |
| 45 | - [ | |
| 46 | - 'wp-i18n', | |
| 47 | - ], | |
| 45 | + [], | |
| 48 | 46 | ELEMENTOR_VERSION, |
| 49 | 47 | true |
| 50 | 48 | ); |
| 51 | 49 | |
| 52 | - wp_set_script_translations( 'announcements-app', 'elementor' ); | |
| 53 | - | |
| 54 | 50 | $this->print_config( 'announcements-app' ); |
| 55 | 51 | } |
| 56 | 52 | |
| 57 | 53 | /** |
| @@ -64,9 +60,9 @@ | ||
| 64 | 60 | $additional_settings = []; |
| 65 | 61 | |
| 66 | 62 | foreach ( $active_announcements as $announcement ) { |
| 67 | 63 | $additional_settings[] = $announcement->get_prepared_data(); |
| 68 | - // @TODO - replace with ajax request from the front after actually triggered | |
| 64 | + //@TODO - replace with ajax request from the front after actually triggered | |
| 69 | 65 | $announcement->after_triggered(); |
| 70 | 66 | } |
| 71 | 67 | |
| 72 | 68 | return [ |
| @@ -91,12 +87,66 @@ | ||
| 91 | 87 | * |
| 92 | 88 | * @return array[] |
| 93 | 89 | */ |
| 94 | 90 | private function get_raw_announcements(): array { |
| 95 | - $raw_announcements = []; | |
| 96 | - | |
| 97 | - // DO NOT USE THIS FILTER | |
| 98 | - return apply_filters( 'elementor/announcements/raw_announcements', $raw_announcements ); | |
| 91 | + return [ | |
| 92 | + [ | |
| 93 | + 'title' => 'Create smarter with Elementor AI', | |
| 94 | + 'description' => '<p>Instantly turn your ideas into original text and custom code with a free trial of Elementor AI installed on the newest versions of Elementor.</p> | |
| 95 | + <ul> | |
| 96 | + <li>Effortlessly write professional copy about any topic, in any tone. Then instantly translate it to twenty-five languages.</li> | |
| 97 | + <li>No code? No problem. Generate Custom Code, CSS, and HTML with a prompt</li> | |
| 98 | + <li>Coming soon: A picture might be worth a thousand words, but all you need is a short description to generate the perfect image for your site.</li> | |
| 99 | + </ul>', | |
| 100 | + 'media' => [ | |
| 101 | + 'type' => 'image', | |
| 102 | + 'src' => ELEMENTOR_ASSETS_URL . 'images/announcement.png', | |
| 103 | + ], | |
| 104 | + 'cta' => [ | |
| 105 | + [ | |
| 106 | + 'label' => 'Continue', | |
| 107 | + 'variant' => 'primary', | |
| 108 | + 'target' => '_blank', | |
| 109 | + ], | |
| 110 | + [ | |
| 111 | + 'label' => 'Learn More', | |
| 112 | + 'target' => '_blank', | |
| 113 | + 'url' => 'https://go.elementor.com/whats-new-popup-learn-elementor-ai/', | |
| 114 | + ], | |
| 115 | + ], | |
| 116 | + 'triggers' => [ | |
| 117 | + [ | |
| 118 | + 'action' => 'aiStared', | |
| 119 | + ], | |
| 120 | + ], | |
| 121 | + ], | |
| 122 | + [ | |
| 123 | + 'title' => 'Activate Containers for Brilliant Layouts', | |
| 124 | + 'description' => 'Take advantage of the full power of Containers in Elementor to create slick, pixel-perfect, responsive layouts, plus improve the performance of your website. Follow these steps: <strong>Switch Flexbox Container to ‘Active’ and Save.</strong>', | |
| 125 | + 'media' => [ | |
| 126 | + 'type' => 'image', | |
| 127 | + 'src' => ELEMENTOR_ASSETS_URL . 'images/containers-announcement.png', | |
| 128 | + ], | |
| 129 | + 'cta' => [ | |
| 130 | + [ | |
| 131 | + 'label' => 'Activate Container', | |
| 132 | + 'variant' => 'primary', | |
| 133 | + 'target' => '_blank', | |
| 134 | + 'url' => ElementorSettings::get_url() . '#tab-experiments', | |
| 135 | + ], | |
| 136 | + [ | |
| 137 | + 'label' => 'Try It First', | |
| 138 | + 'target' => '_blank', | |
| 139 | + 'url' => 'https://go.elementor.com/whats-new-popup/', | |
| 140 | + ], | |
| 141 | + ], | |
| 142 | + 'triggers' => [ | |
| 143 | + [ | |
| 144 | + 'action' => 'isFlexContainerInactive', | |
| 145 | + ], | |
| 146 | + ], | |
| 147 | + ], | |
| 148 | + ]; | |
| 99 | 149 | } |
| 100 | 150 | |
| 101 | 151 | /** |
| 102 | 152 | * Retrieve all announcement objects. |
| @@ -128,17 +178,12 @@ | ||
| 128 | 178 | return $active_announcements; |
| 129 | 179 | } |
| 130 | 180 | |
| 131 | 181 | public function __construct() { |
| 132 | - parent::__construct(); | |
| 133 | - | |
| 134 | - add_action( 'elementor/init', [ $this, 'on_elementor_init' ] ); | |
| 135 | - } | |
| 136 | - | |
| 137 | - public function on_elementor_init() { | |
| 138 | 182 | if ( empty( $this->get_active_announcements() ) ) { |
| 139 | 183 | return; |
| 140 | 184 | } |
| 185 | + parent::__construct(); | |
| 141 | 186 | |
| 142 | 187 | add_action( 'elementor/editor/footer', function () { |
| 143 | 188 | $this->render_app_wrapper(); |
| 144 | 189 | } ); |