PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.4
Elementor Website Builder – more than just a page builder v4.2.4
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 | app/modules/onboarding/module.php +19 -28 4.2.24.2.4 View file →
@@ -2,9 +2,8 @@
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;
7 6 use Elementor\App\Modules\Onboarding\Storage\Entities\User_Choices;
8 7 use Elementor\App\Modules\Onboarding\Storage\Entities\User_Progress;
9 8 use Elementor\App\Modules\Onboarding\Storage\Onboarding_Progress_Manager;
10 9 use Elementor\Core\Base\Module as BaseModule;
@@ -121,8 +120,9 @@
121 120 'steps' => $steps,
122 121 'uiTheme' => $this->get_ui_theme_preference(),
123 122 'translations' => $this->get_translated_strings(),
124 123 '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(),
@@ -135,21 +135,28 @@
135 135 }
136 136
137 137 private function validate_progress_for_steps( User_Progress $progress, array $steps ): array {
138 138 $progress_data = $progress->to_array();
139 + $step_ids = array_column( $steps, 'id' );
139 140 $step_count = count( $steps );
141 + $fallback_step_id = $steps[0]['id'] ?? 'site_features';
140 142 $current_step_index = $progress->get_current_step_index() ?? 0;
141 - $current_step_id = $progress->get_current_step_id() ?? $steps[0]['id'] ?? 'building_for';
143 + $current_step_id = $progress->get_current_step_id() ?? $fallback_step_id;
142 144
143 145 $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 );
144 147
145 - if ( $is_invalid_step_index ) {
146 - $current_step_id = $steps[0]['id'];
148 + if ( $is_invalid_step_index || $is_invalid_step_id ) {
149 + $current_step_id = $fallback_step_id;
147 150 $current_step_index = 0;
148 151 }
149 152
150 153 $progress_data['current_step_id'] = $current_step_id;
151 154 $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 + ) );
152 159
153 160 return $progress_data;
154 161 }
155 162
@@ -186,9 +193,9 @@
186 193 return $connect->get_app( 'library' );
187 194 }
188 195
189 196 public static function should_show_pro_install_screen(): bool {
190 - if ( self::is_elementor_pro_installed() ) {
197 + if ( Utils::has_pro() || Utils::is_pro_installed_and_not_active() ) {
191 198 return false;
192 199 }
193 200
194 201 $connect = Plugin::$instance->common->get_component( 'connect' );
@@ -311,32 +318,14 @@
311 318
312 319 private function get_steps_config(): array {
313 320 $steps = [
314 321 [
315 - 'id' => 'building_for',
316 - 'label' => __( 'Who are you building for?', 'elementor' ),
322 + 'id' => 'theme_selection',
323 + 'label' => __( 'Start with a theme that fits your needs', 'elementor' ),
317 324 'type' => 'single',
318 325 ],
319 - [
320 - 'id' => 'site_about',
321 - 'label' => __( 'What is your site about?', 'elementor' ),
322 - 'type' => 'multiple',
323 - ],
324 - [
325 - 'id' => 'experience_level',
326 - 'label' => __( 'How much experience do you have with Elementor?', 'elementor' ),
327 - 'type' => 'single',
328 - ],
329 326 ];
330 327
331 - if ( ! $this->is_elementor_theme_active() ) {
332 - $steps[] = [
333 - 'id' => 'theme_selection',
334 - 'label' => __( 'Start with a theme that fits your needs', 'elementor' ),
335 - 'type' => 'single',
336 - ];
337 - }
338 -
339 328 if ( ! self::is_elementor_pro_installed() ) {
340 329 $steps[] = [
341 330 'id' => 'site_features',
342 331 'label' => __( 'What do you want to include in your site?', 'elementor' ),
@@ -347,15 +336,17 @@
347 336 return apply_filters( 'elementor/onboarding/steps', $steps );
348 337 }
349 338
350 339 private static function is_elementor_pro_installed(): bool {
351 - $is_pro_installed = Utils::has_pro() || Utils::is_pro_installed_and_not_active();
340 + $is_pro_installed = Utils::has_pro();
352 341 return (bool) apply_filters( 'elementor/onboarding/is_elementor_pro_installed', $is_pro_installed );
353 342 }
354 343
355 - private function is_elementor_theme_active(): bool {
344 + private function is_hello_theme_active(): bool {
356 345 $active_theme = get_stylesheet();
357 - $is_active = in_array( $active_theme, Install_Theme::ALLOWED_THEMES, true );
346 + $is_active = 0 === strpos( $active_theme, 'hello-' );
347 +
348 + $is_active = (bool) apply_filters( 'elementor/onboarding/is_hello_theme_active', $is_active );
358 349
359 350 return (bool) apply_filters( 'elementor/onboarding/is_elementor_theme_active', $is_active );
360 351 }
361 352 }