PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.8
Elementor Website Builder – more than just a page builder v3.35.8
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 +6 -68 4.2.03.35.8 View file →
@@ -16,15 +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 -
27 20 /**
28 21 * Element types.
29 22 *
30 23 * Holds the list of all the element types.
@@ -290,12 +283,16 @@
290 283 * @access private
291 284 */
292 285 private function init_categories() {
293 286 $this->categories = [
294 - self::CATEGORY_ATOMIC_ELEMENTS => [
287 + 'v4-elements' => [
295 288 'title' => esc_html__( 'Atomic Elements', 'elementor' ),
296 289 'hideIfEmpty' => true,
297 290 ],
291 + 'atomic-form' => [
292 + 'title' => esc_html__( 'Atomic Form', 'elementor' ),
293 + 'hideIfEmpty' => true,
294 + ],
298 295 'layout' => [
299 296 'title' => esc_html__( 'Layout', 'elementor' ),
300 297 'hideIfEmpty' => true,
301 298 ],
@@ -336,34 +333,11 @@
336 333 ],
337 334 ],
338 335 ];
339 336
340 - if ( Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ) ) {
341 - $atomic_form_category = [
342 - 'title' => esc_html__( 'Atomic Form', 'elementor' ),
343 - ];
344 -
345 - if ( Utils::has_pro() && Plugin::$instance->experiments->is_feature_active( 'e_pro_atomic_form' ) ) {
346 - $atomic_form_category['hideIfEmpty'] = true;
347 - } elseif ( ! Utils::has_pro() ) {
348 - $atomic_form_category['hideIfEmpty'] = false;
349 - $atomic_form_category['promotion'] = [
350 - 'url' => esc_url( 'https://go.elementor.com/go-pro-atomic-form-section/' ),
351 - ];
352 - } else {
353 - $atomic_form_category['hideIfEmpty'] = true;
354 - }
355 -
356 - $this->categories = array_merge(
357 - [ self::CATEGORY_ATOMIC_ELEMENTS => $this->categories[ self::CATEGORY_ATOMIC_ELEMENTS ] ],
358 - [ self::CATEGORY_ATOMIC_FORM => $atomic_form_category ],
359 - array_diff_key( $this->categories, [ self::CATEGORY_ATOMIC_ELEMENTS => true ] )
360 - );
361 - }
362 -
363 337 // Not using the `add_category` because it doesn't allow 3rd party to inject a category on top the others.
364 338 $this->categories = array_merge_recursive( [
365 - self::CATEGORY_FAVORITES => [
339 + 'favorites' => [
366 340 'title' => esc_html__( 'Favorites', 'elementor' ),
367 341 'icon' => 'eicon-heart',
368 342 'sort' => 'a-z',
369 343 'hideIfEmpty' => false,
@@ -384,15 +358,8 @@
384 358 * @param Elements_Manager $this Elements manager instance.
385 359 */
386 360 do_action( 'elementor/elements/categories_registered', $this );
387 361
388 - $after_candidates = Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' )
389 - ? [ self::CATEGORY_ATOMIC_FORM, self::CATEGORY_ATOMIC_ELEMENTS ]
390 - : [ self::CATEGORY_BASIC ];
391 -
392 - $this->promote_category_after( self::CATEGORY_ANGIE_WIDGETS, $after_candidates );
393 - $this->promote_category_after( self::CATEGORY_CUSTOM_WIDGETS, $after_candidates );
394 -
395 362 $this->categories['wordpress'] = [
396 363 'title' => esc_html__( 'WordPress', 'elementor' ),
397 364 'icon' => 'eicon-wordpress',
398 365 'active' => false,
@@ -414,37 +381,8 @@
414 381 public function register_frontend_handlers() {
415 382 foreach ( $this->get_element_types() as $element ) {
416 383 $element->register_frontend_handlers();
417 384 }
418 - }
419 -
420 - private function promote_category_after( string $category_name, array $after_candidates ): void {
421 - if ( ! isset( $this->categories[ $category_name ] ) ) {
422 - return;
423 - }
424 -
425 - $after = null;
426 -
427 - foreach ( $after_candidates as $candidate ) {
428 - if ( isset( $this->categories[ $candidate ] ) ) {
429 - $after = $candidate;
430 - break;
431 - }
432 - }
433 -
434 - if ( ! $after ) {
435 - return;
436 - }
437 -
438 - $category = $this->categories[ $category_name ];
439 - unset( $this->categories[ $category_name ] );
440 -
441 - $position = array_search( $after, array_keys( $this->categories ), true ) + 1;
442 - $this->categories = array_merge(
443 - array_slice( $this->categories, 0, $position, true ),
444 - [ $category_name => $category ],
445 - array_slice( $this->categories, $position, null, true )
446 - );
447 385 }
448 386
449 387 /**
450 388 * Require files.