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