← All changes
|
modules/components/transformers/component-instance-transformer.php
+3
-10
4.1.1
→
3.35.7
View file →
| @@ -1,16 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Components\Transformers; |
| 4 | 4 | |
| 5 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Render_Context; | |
| 6 | 5 | use Elementor\Modules\AtomicWidgets\PropsResolver\Props_Resolver_Context; |
| 7 | 6 | use Elementor\Modules\AtomicWidgets\PropsResolver\Transformer_Base; |
| 8 | 7 | use Elementor\Plugin; |
| 9 | 8 | use Elementor\Core\Base\Document as Component_Document; |
| 10 | 9 | use Elementor\Modules\Components\Components_Repository; |
| 11 | -use Elementor\Modules\Components\Utils\Format_Component_Elements_Id; | |
| 12 | -use Elementor\Modules\Components\Widgets\Component_Instance; | |
| 13 | 10 | |
| 14 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 12 | exit; // Exit if accessed directly. |
| 16 | 13 | } |
| @@ -29,12 +26,10 @@ | ||
| 29 | 26 | if ( $this->is_circular_reference( $component_id ) ) { |
| 30 | 27 | return ''; |
| 31 | 28 | } |
| 32 | 29 | |
| 33 | - $instance_element_id = Render_Context::get( Component_Instance::class )['instance_id'] ?? ''; | |
| 34 | - | |
| 35 | 30 | self::$rendering_stack[] = $component_id; |
| 36 | - $content = $this->get_rendered_content( $component_id, $instance_element_id ); | |
| 31 | + $content = $this->get_rendered_content( $component_id ); | |
| 37 | 32 | array_pop( self::$rendering_stack ); |
| 38 | 33 | |
| 39 | 34 | return $content; |
| 40 | 35 | } |
| @@ -42,9 +37,9 @@ | ||
| 42 | 37 | private function is_circular_reference( int $component_id ): bool { |
| 43 | 38 | return in_array( $component_id, self::$rendering_stack, true ); |
| 44 | 39 | } |
| 45 | 40 | |
| 46 | - private function get_rendered_content( int $component_id, ?string $instance_element_id ): string { | |
| 41 | + private function get_rendered_content( int $component_id ): string { | |
| 47 | 42 | $should_show_autosave = is_preview(); |
| 48 | 43 | $component = $this->get_repository()->get( $component_id, $should_show_autosave ); |
| 49 | 44 | |
| 50 | 45 | if ( ! $component || ! $this->should_render_content( $component ) ) { |
| @@ -56,16 +51,14 @@ | ||
| 56 | 51 | $data = $component->get_elements_data(); |
| 57 | 52 | |
| 58 | 53 | $data = apply_filters( 'elementor/frontend/builder_content_data', $data, $component_id ); |
| 59 | 54 | |
| 60 | - $data = Format_Component_Elements_Id::format( $data, [ $instance_element_id ] ); | |
| 61 | - | |
| 62 | 55 | $content = ''; |
| 63 | 56 | |
| 64 | 57 | if ( ! empty( $data ) ) { |
| 65 | 58 | ob_start(); |
| 66 | 59 | |
| 67 | - $component->print_elements_without_cache( $data ); | |
| 60 | + $component->print_elements( $data ); | |
| 68 | 61 | |
| 69 | 62 | $content = ob_get_clean(); |
| 70 | 63 | |
| 71 | 64 | $content = apply_filters( 'elementor/frontend/the_content', $content ); |