← All changes
|
modules/atomic-widgets/elements/base/has-template.php
+2
-18
4.1.5
→
4.0.3
View file →
| @@ -13,12 +13,8 @@ | ||
| 13 | 13 | * @mixin Has_Atomic_Base |
| 14 | 14 | */ |
| 15 | 15 | trait Has_Template { |
| 16 | 16 | |
| 17 | - private static function get_macros_template_key(): string { | |
| 18 | - return 'elementor/macros'; | |
| 19 | - } | |
| 20 | - | |
| 21 | 17 | public function get_initial_config() { |
| 22 | 18 | $config = parent::get_initial_config(); |
| 23 | 19 | |
| 24 | 20 | $config['twig_main_template'] = $this->get_main_template(); |
| @@ -25,25 +21,13 @@ | ||
| 25 | 21 | $config['twig_templates'] = $this->get_templates_contents(); |
| 26 | 22 | return $config; |
| 27 | 23 | } |
| 28 | 24 | |
| 29 | - protected function transform_link_for_render( array $parsed ): array { | |
| 30 | - return $parsed; | |
| 31 | - } | |
| 32 | - | |
| 33 | - protected function get_shared_templates(): array { | |
| 34 | - return [ | |
| 35 | - self::get_macros_template_key() => __DIR__ . '/_macros.html.twig', | |
| 36 | - ]; | |
| 37 | - } | |
| 38 | - | |
| 39 | 25 | protected function render() { |
| 40 | 26 | try { |
| 41 | 27 | $renderer = Template_Renderer::instance(); |
| 42 | 28 | |
| 43 | - $all_templates = array_merge( $this->get_shared_templates(), $this->get_templates() ); | |
| 44 | - | |
| 45 | - foreach ( $all_templates as $name => $path ) { | |
| 29 | + foreach ( $this->get_templates() as $name => $path ) { | |
| 46 | 30 | if ( $renderer->is_registered( $name ) ) { |
| 47 | 31 | continue; |
| 48 | 32 | } |
| 49 | 33 | |
| @@ -69,9 +53,9 @@ | ||
| 69 | 53 | |
| 70 | 54 | protected function get_templates_contents() { |
| 71 | 55 | return array_map( |
| 72 | 56 | fn ( $path ) => Utils::file_get_contents( $path ), |
| 73 | - array_merge( $this->get_shared_templates(), $this->get_templates() ) | |
| 57 | + $this->get_templates() | |
| 74 | 58 | ); |
| 75 | 59 | } |
| 76 | 60 | |
| 77 | 61 | protected function get_main_template() { |