PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.8
Elementor Website Builder – more than just a page builder v3.4.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 +11 -134 4.0.73.4.8 View file →
@@ -1,9 +1,7 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Includes\Elements\Container;
5 -
6 4 if ( ! defined( 'ABSPATH' ) ) {
7 5 exit; // Exit if accessed directly.
8 6 }
9 7
@@ -16,13 +14,8 @@
16 14 * @since 1.0.0
17 15 */
18 16 class Elements_Manager {
19 17
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 -
25 18 /**
26 19 * Element types.
27 20 *
28 21 * Holds the list of all the element types.
@@ -39,9 +32,9 @@
39 32 * Holds the list of all the element categories.
40 33 *
41 34 * @access private
42 35 *
43 - * @var $categories
36 + * @var
44 37 */
45 38 private $categories;
46 39
47 40 /**
@@ -71,11 +64,15 @@
71 64 *
72 65 * @return Element_Base|null Element instance if element created, or null
73 66 * otherwise.
74 67 */
75 - public function create_element_instance( array $element_data, array $element_args = [], ?Element_Base $element_type = null ) {
68 + public function create_element_instance( array $element_data, array $element_args = [], Element_Base $element_type = null ) {
76 69 if ( null === $element_type ) {
77 - $element_type = $this->get_element( $element_data['elType'], isset( $element_data['widgetType'] ) ? $element_data['widgetType'] : null );
70 + if ( 'widget' === $element_data['elType'] ) {
71 + $element_type = Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
72 + } else {
73 + $element_type = $this->get_element_types( $element_data['elType'] );
74 + }
78 75 }
79 76
80 77 if ( ! $element_type ) {
81 78 return null;
@@ -93,20 +90,8 @@
93 90
94 91 return $element;
95 92 }
96 93
97 - public function get_element( string $el_type, ?string $widget_type = null ) {
98 - $element = null;
99 -
100 - if ( 'widget' === $el_type ) {
101 - $element = Plugin::$instance->widgets_manager->get_widget_types( $widget_type );
102 - } else {
103 - $element = $this->get_element_types( $el_type );
104 - }
105 -
106 - return $element;
107 - }
108 -
109 94 /**
110 95 * Get element categories.
111 96 *
112 97 * Retrieve the list of categories the element belongs to.
@@ -262,14 +247,8 @@
262 247
263 248 $this->register_element_type( new $class_name() );
264 249 }
265 250
266 - $experiments_manager = Plugin::$instance->experiments;
267 -
268 - if ( $experiments_manager->is_feature_active( 'container' ) ) {
269 - $this->register_element_type( new Container() );
270 - }
271 -
272 251 /**
273 252 * After elements registered.
274 253 *
275 254 * Fires after Elementor elements are registered.
@@ -288,16 +267,8 @@
288 267 * @access private
289 268 */
290 269 private function init_categories() {
291 270 $this->categories = [
292 - self::CATEGORY_ATOMIC_ELEMENTS => [
293 - 'title' => esc_html__( 'Atomic Elements', 'elementor' ),
294 - 'hideIfEmpty' => true,
295 - ],
296 - 'layout' => [
297 - 'title' => esc_html__( 'Layout', 'elementor' ),
298 - 'hideIfEmpty' => true,
299 - ],
300 271 'basic' => [
301 272 'title' => esc_html__( 'Basic', 'elementor' ),
302 273 'icon' => 'eicon-font',
303 274 ],
@@ -302,73 +273,23 @@
302 273 'icon' => 'eicon-font',
303 274 ],
304 275 'pro-elements' => [
305 276 'title' => esc_html__( 'Pro', 'elementor' ),
306 - 'promotion' => [
307 - 'url' => esc_url( 'https://go.elementor.com/go-pro-section-pro-widget-panel/' ),
308 - ],
309 277 ],
310 - 'helloplus' => [
311 - 'title' => esc_html__( 'Hello+', 'elementor' ),
312 - 'hideIfEmpty' => true,
313 - ],
314 278 'general' => [
315 279 'title' => esc_html__( 'General', 'elementor' ),
316 280 'icon' => 'eicon-font',
317 281 ],
318 - 'link-in-bio' => [
319 - 'title' => esc_html__( 'Link In Bio', 'elementor' ),
320 - 'hideIfEmpty' => true,
321 - ],
322 282 'theme-elements' => [
323 283 'title' => esc_html__( 'Site', 'elementor' ),
324 284 'active' => false,
325 - 'promotion' => [
326 - 'url' => esc_url( 'https://go.elementor.com/go-pro-section-site-widget-panel/' ),
327 - ],
328 285 ],
329 286 'woocommerce-elements' => [
330 287 'title' => esc_html__( 'WooCommerce', 'elementor' ),
331 288 'active' => false,
332 - 'promotion' => [
333 - 'url' => esc_url( 'https://go.elementor.com/go-pro-section-woocommerce-widget-panel/' ),
334 - ],
335 289 ],
336 290 ];
337 291
338 - if ( Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' ) ) {
339 - $atomic_form_category = [
340 - 'title' => esc_html__( 'Atomic Form', 'elementor' ),
341 - ];
342 -
343 - if ( Utils::has_pro() && Plugin::$instance->experiments->is_feature_active( 'e_pro_atomic_form' ) ) {
344 - $atomic_form_category['hideIfEmpty'] = true;
345 - } elseif ( ! Utils::has_pro() ) {
346 - $atomic_form_category['hideIfEmpty'] = false;
347 - $atomic_form_category['promotion'] = [
348 - 'url' => esc_url( 'https://go.elementor.com/go-pro-atomic-form-section/' ),
349 - ];
350 - } else {
351 - $atomic_form_category['hideIfEmpty'] = true;
352 - }
353 -
354 - $this->categories = array_merge(
355 - [ self::CATEGORY_ATOMIC_ELEMENTS => $this->categories[ self::CATEGORY_ATOMIC_ELEMENTS ] ],
356 - [ self::CATEGORY_ATOMIC_FORM => $atomic_form_category ],
357 - array_diff_key( $this->categories, [ self::CATEGORY_ATOMIC_ELEMENTS => true ] )
358 - );
359 - }
360 -
361 - // Not using the `add_category` because it doesn't allow 3rd party to inject a category on top the others.
362 - $this->categories = array_merge_recursive( [
363 - self::CATEGORY_FAVORITES => [
364 - 'title' => esc_html__( 'Favorites', 'elementor' ),
365 - 'icon' => 'eicon-heart',
366 - 'sort' => 'a-z',
367 - 'hideIfEmpty' => false,
368 - ],
369 - ], $this->categories );
370 -
371 292 /**
372 293 * When categories are registered.
373 294 *
374 295 * Fires after basic categories are registered, before WordPress
@@ -382,9 +303,12 @@
382 303 * @param Elements_Manager $this Elements manager instance.
383 304 */
384 305 do_action( 'elementor/elements/categories_registered', $this );
385 306
386 - $this->promote_category_after( self::CATEGORY_ANGIE_WIDGETS, [ self::CATEGORY_ATOMIC_FORM, self::CATEGORY_ATOMIC_ELEMENTS ] );
307 + $this->categories['pojo'] = [
308 + 'title' => esc_html__( 'Pojo Themes', 'elementor' ),
309 + 'icon' => 'eicon-pojome',
310 + ];
387 311
388 312 $this->categories['wordpress'] = [
389 313 'title' => esc_html__( 'WordPress', 'elementor' ),
390 314 'icon' => 'eicon-wordpress',
@@ -389,55 +313,8 @@
389 313 'title' => esc_html__( 'WordPress', 'elementor' ),
390 314 'icon' => 'eicon-wordpress',
391 315 'active' => false,
392 316 ];
393 - }
394 -
395 - public function enqueue_elements_styles() {
396 - foreach ( $this->get_element_types() as $element ) {
397 - $element->enqueue_styles();
398 - }
399 - }
400 -
401 - public function enqueue_elements_scripts() {
402 - foreach ( $this->get_element_types() as $element ) {
403 - $element->enqueue_scripts();
404 - }
405 - }
406 -
407 - public function register_frontend_handlers() {
408 - foreach ( $this->get_element_types() as $element ) {
409 - $element->register_frontend_handlers();
410 - }
411 - }
412 -
413 - private function promote_category_after( string $category_name, array $after_candidates ): void {
414 - if ( ! isset( $this->categories[ $category_name ] ) ) {
415 - return;
416 - }
417 -
418 - $after = null;
419 -
420 - foreach ( $after_candidates as $candidate ) {
421 - if ( isset( $this->categories[ $candidate ] ) ) {
422 - $after = $candidate;
423 - break;
424 - }
425 - }
426 -
427 - if ( ! $after ) {
428 - return;
429 - }
430 -
431 - $category = $this->categories[ $category_name ];
432 - unset( $this->categories[ $category_name ] );
433 -
434 - $position = array_search( $after, array_keys( $this->categories ), true ) + 1;
435 - $this->categories = array_merge(
436 - array_slice( $this->categories, 0, $position, true ),
437 - [ $category_name => $category ],
438 - array_slice( $this->categories, $position, null, true )
439 - );
440 317 }
441 318
442 319 /**
443 320 * Require files.