PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.3
Elementor Website Builder – more than just a page builder v4.1.3
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/widgets.php +29 -0 4.0.94.1.3 View file →
@@ -408,8 +408,35 @@
408 408
409 409 return $config;
410 410 }
411 411
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 +
412 439 public function ajax_get_widgets_default_value_translations( array $data = [] ) {
413 440 $locale = empty( $data['locale'] )
414 441 ? get_locale()
415 442 : $data['locale'];
@@ -737,8 +764,10 @@
737 764 public function register_ajax_actions( Ajax $ajax_manager ) {
738 765 $ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] );
739 766 $ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] );
740 767 $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' ] );
741 770
742 771 $ajax_manager->register_ajax_action( 'get_widgets_default_value_translations', function ( array $data ) {
743 772 return $this->ajax_get_widgets_default_value_translations( $data );
744 773 } );