PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-beta1
Elementor Website Builder – more than just a page builder v4.0.0-beta1
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 | app/modules/onboarding/module.php +29 -23 4.2.4 → 4.0.0-beta1 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Elementor\App\Modules\Onboarding;
4 4
5 5 use Elementor\App\Modules\Onboarding\Data\Controller;
6 +use Elementor\App\Modules\Onboarding\Data\Endpoints\Install_Theme;
6 7 use Elementor\App\Modules\Onboarding\Storage\Entities\User_Choices;
7 8 use Elementor\App\Modules\Onboarding\Storage\Entities\User_Progress;
8 9 use Elementor\App\Modules\Onboarding\Storage\Onboarding_Progress_Manager;
9 10 use Elementor\Core\Base\Module as BaseModule;
@@ -120,14 +121,12 @@
120 121 'steps' => $steps,
121 122 'uiTheme' => $this->get_ui_theme_preference(),
122 123 'translations' => $this->get_translated_strings(),
123 124 'shouldShowProInstallScreen' => $is_connected ? $this->should_show_pro_install_screen() : false,
124 - 'isHelloThemeActive' => $this->is_hello_theme_active(),
125 125 'urls' => [
126 126 'dashboard' => admin_url(),
127 127 'editor' => admin_url( 'edit.php?post_type=elementor_library' ),
128 128 'connect' => $this->get_connect_url(),
129 - 'signUp' => $this->get_connect_url( 'signup' ),
130 129 'comparePlans' => 'https://go.elementor.com/go-pro-onboarding-editor-features-step-upgrade/',
131 130 'createNewPage' => Plugin::$instance->documents->get_create_new_post_url(),
132 131 'upgradeUrl' => 'https://go.elementor.com/go-pro-onboarding-editor-header-upgrade/',
133 132 ],
@@ -135,28 +134,21 @@
135 134 }
136 135
137 136 private function validate_progress_for_steps( User_Progress $progress, array $steps ): array {
138 137 $progress_data = $progress->to_array();
139 - $step_ids = array_column( $steps, 'id' );
140 138 $step_count = count( $steps );
141 - $fallback_step_id = $steps[0]['id'] ?? 'site_features';
142 139 $current_step_index = $progress->get_current_step_index() ?? 0;
143 - $current_step_id = $progress->get_current_step_id() ?? $fallback_step_id;
140 + $current_step_id = $progress->get_current_step_id() ?? $steps[0]['id'] ?? 'building_for';
144 141
145 142 $is_invalid_step_index = $current_step_index < 0 || $current_step_index >= $step_count;
146 - $is_invalid_step_id = ! in_array( $current_step_id, $step_ids, true );
147 143
148 - if ( $is_invalid_step_index || $is_invalid_step_id ) {
149 - $current_step_id = $fallback_step_id;
144 + if ( $is_invalid_step_index ) {
145 + $current_step_id = $steps[0]['id'];
150 146 $current_step_index = 0;
151 147 }
152 148
153 149 $progress_data['current_step_id'] = $current_step_id;
154 150 $progress_data['current_step_index'] = $current_step_index;
155 - $progress_data['completed_steps'] = array_values( array_filter(
156 - $progress->get_completed_steps(),
157 - static fn( $step_id ) => in_array( $step_id, $step_ids, true )
158 - ) );
159 151
160 152 return $progress_data;
161 153 }
162 154
@@ -165,9 +157,9 @@
165 157
166 158 return $library ? $library->is_connected() : false;
167 159 }
168 160
169 - private function get_connect_url( string $screen_hint = '' ): string {
161 + private function get_connect_url(): string {
170 162 $library = $this->get_library_app();
171 163
172 164 if ( ! $library ) {
173 165 return '';
@@ -178,9 +170,8 @@
178 170 'utm_campaign' => 'connect-account',
179 171 'utm_medium' => 'wp-dash',
180 172 'utm_term' => self::VERSION,
181 173 'source' => 'generic',
182 - 'screen_hint' => $screen_hint,
183 174 ] ) ?? '';
184 175 }
185 176
186 177 private function get_library_app() {
@@ -193,9 +184,9 @@
193 184 return $connect->get_app( 'library' );
194 185 }
195 186
196 187 public static function should_show_pro_install_screen(): bool {
197 - if ( Utils::has_pro() || Utils::is_pro_installed_and_not_active() ) {
188 + if ( self::is_elementor_pro_installed() ) {
198 189 return false;
199 190 }
200 191
201 192 $connect = Plugin::$instance->common->get_component( 'connect' );
@@ -250,9 +241,8 @@
250 241 public function add_starter_settings( array $settings ): array {
251 242 $settings['starter'] = [
252 243 'restPath' => 'elementor/v1/onboarding/user-progress',
253 244 'aiPlannerUrl' => 'https://planner.elementor.com/home.html',
254 - 'kitLibraryUrl' => Plugin::$instance->app->get_base_url() . '#/kit-library',
255 245 ];
256 246
257 247 return $settings;
258 248 }
@@ -318,13 +308,31 @@
318 308
319 309 private function get_steps_config(): array {
320 310 $steps = [
321 311 [
312 + 'id' => 'building_for',
313 + 'label' => __( 'Who are you building for?', 'elementor' ),
314 + 'type' => 'single',
315 + ],
316 + [
317 + 'id' => 'site_about',
318 + 'label' => __( 'What is your site about?', 'elementor' ),
319 + 'type' => 'multiple',
320 + ],
321 + [
322 + 'id' => 'experience_level',
323 + 'label' => __( 'How much experience do you have with Elementor?', 'elementor' ),
324 + 'type' => 'single',
325 + ],
326 + ];
327 +
328 + if ( ! $this->is_elementor_theme_active() ) {
329 + $steps[] = [
322 330 'id' => 'theme_selection',
323 331 'label' => __( 'Start with a theme that fits your needs', 'elementor' ),
324 332 'type' => 'single',
325 - ],
326 - ];
333 + ];
334 + }
327 335
328 336 if ( ! self::is_elementor_pro_installed() ) {
329 337 $steps[] = [
330 338 'id' => 'site_features',
@@ -336,17 +344,15 @@
336 344 return apply_filters( 'elementor/onboarding/steps', $steps );
337 345 }
338 346
339 347 private static function is_elementor_pro_installed(): bool {
340 - $is_pro_installed = Utils::has_pro();
348 + $is_pro_installed = Utils::has_pro() || Utils::is_pro_installed_and_not_active();
341 349 return (bool) apply_filters( 'elementor/onboarding/is_elementor_pro_installed', $is_pro_installed );
342 350 }
343 351
344 - private function is_hello_theme_active(): bool {
352 + private function is_elementor_theme_active(): bool {
345 353 $active_theme = get_stylesheet();
346 - $is_active = 0 === strpos( $active_theme, 'hello-' );
347 -
348 - $is_active = (bool) apply_filters( 'elementor/onboarding/is_hello_theme_active', $is_active );
354 + $is_active = in_array( $active_theme, Install_Theme::ALLOWED_THEMES, true );
349 355
350 356 return (bool) apply_filters( 'elementor/onboarding/is_elementor_theme_active', $is_active );
351 357 }
352 358 }