PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-dev4
Elementor Website Builder – more than just a page builder v4.0.0-dev4
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 +29 -22 4.2.34.0.0-dev4 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' );
@@ -318,13 +309,31 @@
318 309
319 310 private function get_steps_config(): array {
320 311 $steps = [
321 312 [
313 + 'id' => 'building_for',
314 + 'label' => __( 'Who are you building for?', 'elementor' ),
315 + 'type' => 'single',
316 + ],
317 + [
318 + 'id' => 'site_about',
319 + 'label' => __( 'What is your site about?', 'elementor' ),
320 + 'type' => 'multiple',
321 + ],
322 + [
323 + 'id' => 'experience_level',
324 + 'label' => __( 'How much experience do you have with Elementor?', 'elementor' ),
325 + 'type' => 'single',
326 + ],
327 + ];
328 +
329 + if ( ! $this->is_elementor_theme_active() ) {
330 + $steps[] = [
322 331 'id' => 'theme_selection',
323 332 'label' => __( 'Start with a theme that fits your needs', 'elementor' ),
324 333 'type' => 'single',
325 - ],
326 - ];
334 + ];
335 + }
327 336
328 337 if ( ! self::is_elementor_pro_installed() ) {
329 338 $steps[] = [
330 339 'id' => 'site_features',
@@ -336,17 +345,15 @@
336 345 return apply_filters( 'elementor/onboarding/steps', $steps );
337 346 }
338 347
339 348 private static function is_elementor_pro_installed(): bool {
340 - $is_pro_installed = Utils::has_pro();
349 + $is_pro_installed = Utils::has_pro() || Utils::is_pro_installed_and_not_active();
341 350 return (bool) apply_filters( 'elementor/onboarding/is_elementor_pro_installed', $is_pro_installed );
342 351 }
343 352
344 - private function is_hello_theme_active(): bool {
353 + private function is_elementor_theme_active(): bool {
345 354 $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 );
355 + $is_active = in_array( $active_theme, Install_Theme::ALLOWED_THEMES, true );
349 356
350 357 return (bool) apply_filters( 'elementor/onboarding/is_elementor_theme_active', $is_active );
351 358 }
352 359 }