| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 5 | 5 | use Elementor\Core\Utils\Collection; |
| 6 | +use Elementor\Core\Utils\Exceptions; | |
| 6 | 7 | use Elementor\Core\Utils\Force_Locale; |
| 7 | 8 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Button\Atomic_Button; |
| 8 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Divider\Atomic_Divider; | |
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Heading\Atomic_Heading; |
| 10 | 10 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Image\Atomic_Image; |
| 11 | 11 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Paragraph\Atomic_Paragraph; |
| 12 | 12 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Svg\Atomic_Svg; |
| @@ -62,9 +62,8 @@ | ||
| 62 | 62 | Atomic_Image::class, |
| 63 | 63 | Atomic_Paragraph::class, |
| 64 | 64 | Atomic_Button::class, |
| 65 | 65 | Atomic_Svg::class, |
| 66 | - Atomic_Divider::class, | |
| 67 | 66 | ], |
| 68 | 67 | ]; |
| 69 | 68 | |
| 70 | 69 | /** |
| @@ -385,9 +384,9 @@ | ||
| 385 | 384 | return $config; |
| 386 | 385 | } |
| 387 | 386 | |
| 388 | 387 | /** |
| 389 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 388 | + * @throws \Exception Exception. | |
| 390 | 389 | */ |
| 391 | 390 | public function ajax_get_widget_types_controls_config( array $data ) { |
| 392 | 391 | Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); |
| 393 | 392 | |
| @@ -408,35 +407,8 @@ | ||
| 408 | 407 | |
| 409 | 408 | return $config; |
| 410 | 409 | } |
| 411 | 410 | |
| 412 | - /** | |
| 413 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 414 | - */ | |
| 415 | - public function ajax_refresh_widgets_config( array $data ) { | |
| 416 | - Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); | |
| 417 | - | |
| 418 | - wp_raise_memory_limit( 'admin' ); | |
| 419 | - | |
| 420 | - $widgets = []; | |
| 421 | - | |
| 422 | - foreach ( $this->get_widget_types() as $widget_key => $widget ) { | |
| 423 | - $widget_config = $widget->get_config(); | |
| 424 | - | |
| 425 | - // get_config() omits controls when the stack isn't initialized yet (see Widget_Base::get_initial_config). | |
| 426 | - // During an AJAX refresh the instances are fresh, so we force-initialize and merge them explicitly. | |
| 427 | - $widget_config['controls'] = $widget->get_stack( false )['controls']; | |
| 428 | - $widget_config['tabs_controls'] = $widget->get_tabs_controls(); | |
| 429 | - | |
| 430 | - $widgets[ $widget_key ] = $widget_config; | |
| 431 | - } | |
| 432 | - | |
| 433 | - return [ | |
| 434 | - 'widgets' => $widgets, | |
| 435 | - 'categories' => Plugin::$instance->elements_manager->get_categories(), | |
| 436 | - ]; | |
| 437 | - } | |
| 438 | - | |
| 439 | 411 | public function ajax_get_widgets_default_value_translations( array $data = [] ) { |
| 440 | 412 | $locale = empty( $data['locale'] ) |
| 441 | 413 | ? get_locale() |
| 442 | 414 | : $data['locale']; |
| @@ -520,9 +492,9 @@ | ||
| 520 | 492 | * |
| 521 | 493 | * @param array $request Ajax request. |
| 522 | 494 | * |
| 523 | 495 | * @return bool|string Rendered widget form. |
| 524 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 496 | + * @throws \Exception If there is an error processing the request. | |
| 525 | 497 | */ |
| 526 | 498 | public function ajax_get_wp_widget_form( $request ) { |
| 527 | 499 | Plugin::$instance->documents->check_permissions( $request['editor_post_id'] ); |
| 528 | 500 | |
| @@ -661,14 +633,8 @@ | ||
| 661 | 633 | $widget->enqueue_scripts(); |
| 662 | 634 | } |
| 663 | 635 | } |
| 664 | 636 | |
| 665 | - public function register_frontend_handlers() { | |
| 666 | - foreach ( $this->get_widget_types() as $widget ) { | |
| 667 | - $widget->register_frontend_handlers(); | |
| 668 | - } | |
| 669 | - } | |
| 670 | - | |
| 671 | 637 | /** |
| 672 | 638 | * Enqueue widgets styles |
| 673 | 639 | * |
| 674 | 640 | * Enqueue all the styles defined as a dependency for each widget |
| @@ -764,10 +730,8 @@ | ||
| 764 | 730 | public function register_ajax_actions( Ajax $ajax_manager ) { |
| 765 | 731 | $ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] ); |
| 766 | 732 | $ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] ); |
| 767 | 733 | $ajax_manager->register_ajax_action( 'get_widgets_config', [ $this, 'ajax_get_widget_types_controls_config' ] ); |
| 768 | - | |
| 769 | - $ajax_manager->register_ajax_action( 'refresh_widgets_config', [ $this, 'ajax_refresh_widgets_config' ] ); | |
| 770 | 734 | |
| 771 | 735 | $ajax_manager->register_ajax_action( 'get_widgets_default_value_translations', function ( array $data ) { |
| 772 | 736 | return $this->ajax_get_widgets_default_value_translations( $data ); |
| 773 | 737 | } ); |