PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.7
Elementor Website Builder – more than just a page builder v3.35.7
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 +12 -79 4.3.0-beta23.35.7 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,23 +358,13 @@
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 - }
362 + $this->categories['wordpress'] = [
363 + 'title' => esc_html__( 'WordPress', 'elementor' ),
364 + 'icon' => 'eicon-wordpress',
365 + 'active' => false,
366 + ];
405 367 }
406 368
407 369 public function enqueue_elements_styles() {
408 370 foreach ( $this->get_element_types() as $element ) {
@@ -419,37 +381,8 @@
419 381 public function register_frontend_handlers() {
420 382 foreach ( $this->get_element_types() as $element ) {
421 383 $element->register_frontend_handlers();
422 384 }
423 - }
424 -
425 - private function promote_category_after( string $category_name, array $after_candidates ): void {
426 - if ( ! isset( $this->categories[ $category_name ] ) ) {
427 - return;
428 - }
429 -
430 - $after = null;
431 -
432 - foreach ( $after_candidates as $candidate ) {
433 - if ( isset( $this->categories[ $candidate ] ) ) {
434 - $after = $candidate;
435 - break;
436 - }
437 - }
438 -
439 - if ( ! $after ) {
440 - return;
441 - }
442 -
443 - $category = $this->categories[ $category_name ];
444 - unset( $this->categories[ $category_name ] );
445 -
446 - $position = array_search( $after, array_keys( $this->categories ), true ) + 1;
447 - $this->categories = array_merge(
448 - array_slice( $this->categories, 0, $position, true ),
449 - [ $category_name => $category ],
450 - array_slice( $this->categories, $position, null, true )
451 - );
452 385 }
453 386
454 387 /**
455 388 * Require files.