PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev4
Elementor Website Builder – more than just a page builder v3.35.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 | includes/managers/elements.php +7 -80 4.2.33.35.0-dev4 View file →
@@ -16,17 +16,8 @@
16 16 * @since 1.0.0
17 17 */
18 18 class Elements_Manager {
19 19
20 - const CATEGORY_ATOMIC_ELEMENTS = 'v4-elements';
21 - const CATEGORY_ATOMIC_FORM = 'atomic-form';
22 - const CATEGORY_FAVORITES = 'favorites';
23 - const CATEGORY_ANGIE_WIDGETS = 'angie-widgets';
24 - const CATEGORY_CUSTOM_WIDGETS = 'custom-widgets';
25 - const CATEGORY_BASIC = 'basic';
26 - const CATEGORY_PRO_ELEMENTS = 'pro-elements';
27 - const CATEGORY_WORDPRESS = 'wordpress';
28 -
29 20 /**
30 21 * Element types.
31 22 *
32 23 * Holds the list of all the element types.
@@ -292,12 +283,16 @@
292 283 * @access private
293 284 */
294 285 private function init_categories() {
295 286 $this->categories = [
296 - self::CATEGORY_ATOMIC_ELEMENTS => [
287 + 'v4-elements' => [
297 288 'title' => esc_html__( 'Atomic Elements', 'elementor' ),
298 289 'hideIfEmpty' => true,
299 290 ],
291 + 'atomic-form' => [
292 + 'title' => esc_html__( 'Atomic Form', 'elementor' ),
293 + 'hideIfEmpty' => true,
294 + ],
300 295 'layout' => [
301 296 'title' => esc_html__( 'Layout', 'elementor' ),
302 297 'hideIfEmpty' => true,
303 298 ],
@@ -304,9 +299,9 @@
304 299 'basic' => [
305 300 'title' => esc_html__( 'Basic', 'elementor' ),
306 301 'icon' => 'eicon-font',
307 302 ],
308 - self::CATEGORY_PRO_ELEMENTS => [
303 + 'pro-elements' => [
309 304 'title' => esc_html__( 'Pro', 'elementor' ),
310 305 'promotion' => [
311 306 'url' => esc_url( 'https://go.elementor.com/go-pro-section-pro-widget-panel/' ),
312 307 ],
@@ -338,34 +333,11 @@
338 333 ],
339 334 ],
340 335 ];
341 336
342 - if ( Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ) ) {
343 - $atomic_form_category = [
344 - 'title' => esc_html__( 'Atomic Form', 'elementor' ),
345 - ];
346 -
347 - if ( Utils::has_pro() && Plugin::$instance->experiments->is_feature_active( 'e_pro_atomic_form' ) ) {
348 - $atomic_form_category['hideIfEmpty'] = true;
349 - } elseif ( ! Utils::has_pro() ) {
350 - $atomic_form_category['hideIfEmpty'] = false;
351 - $atomic_form_category['promotion'] = [
352 - 'url' => esc_url( 'https://go.elementor.com/go-pro-atomic-form-section/' ),
353 - ];
354 - } else {
355 - $atomic_form_category['hideIfEmpty'] = true;
356 - }
357 -
358 - $this->categories = array_merge(
359 - [ self::CATEGORY_ATOMIC_ELEMENTS => $this->categories[ self::CATEGORY_ATOMIC_ELEMENTS ] ],
360 - [ self::CATEGORY_ATOMIC_FORM => $atomic_form_category ],
361 - array_diff_key( $this->categories, [ self::CATEGORY_ATOMIC_ELEMENTS => true ] )
362 - );
363 - }
364 -
365 337 // Not using the `add_category` because it doesn't allow 3rd party to inject a category on top the others.
366 338 $this->categories = array_merge_recursive( [
367 - self::CATEGORY_FAVORITES => [
339 + 'favorites' => [
368 340 'title' => esc_html__( 'Favorites', 'elementor' ),
369 341 'icon' => 'eicon-heart',
370 342 'sort' => 'a-z',
371 343 'hideIfEmpty' => false,
@@ -386,24 +358,8 @@
386 358 * @param Elements_Manager $this Elements manager instance.
387 359 */
388 360 do_action( 'elementor/elements/categories_registered', $this );
389 361
390 - $after_candidates = Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' )
391 - ? [ self::CATEGORY_ATOMIC_FORM, self::CATEGORY_ATOMIC_ELEMENTS ]
392 - : [ self::CATEGORY_BASIC ];
393 -
394 - $this->promote_category_after( self::CATEGORY_ANGIE_WIDGETS, $after_candidates );
395 - $this->promote_category_after( self::CATEGORY_CUSTOM_WIDGETS, $after_candidates );
396 -
397 - if ( ! Utils::has_pro() && Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ) ) {
398 - $this->promote_category_after( self::CATEGORY_PRO_ELEMENTS, [
399 - self::CATEGORY_CUSTOM_WIDGETS,
400 - self::CATEGORY_ANGIE_WIDGETS,
401 - self::CATEGORY_ATOMIC_FORM,
402 - self::CATEGORY_ATOMIC_ELEMENTS,
403 - ] );
404 - }
405 -
406 362 $this->categories['wordpress'] = [
407 363 'title' => esc_html__( 'WordPress', 'elementor' ),
408 364 'icon' => 'eicon-wordpress',
409 365 'active' => false,
@@ -425,37 +381,8 @@
425 381 public function register_frontend_handlers() {
426 382 foreach ( $this->get_element_types() as $element ) {
427 383 $element->register_frontend_handlers();
428 384 }
429 - }
430 -
431 - private function promote_category_after( string $category_name, array $after_candidates ): void {
432 - if ( ! isset( $this->categories[ $category_name ] ) ) {
433 - return;
434 - }
435 -
436 - $after = null;
437 -
438 - foreach ( $after_candidates as $candidate ) {
439 - if ( isset( $this->categories[ $candidate ] ) ) {
440 - $after = $candidate;
441 - break;
442 - }
443 - }
444 -
445 - if ( ! $after ) {
446 - return;
447 - }
448 -
449 - $category = $this->categories[ $category_name ];
450 - unset( $this->categories[ $category_name ] );
451 -
452 - $position = array_search( $after, array_keys( $this->categories ), true ) + 1;
453 - $this->categories = array_merge(
454 - array_slice( $this->categories, 0, $position, true ),
455 - [ $category_name => $category ],
456 - array_slice( $this->categories, $position, null, true )
457 - );
458 385 }
459 386
460 387 /**
461 388 * Require files.