← All changes
|
modules/atomic-widgets/elements/base/has-template.php
+3
-22
4.3.0-beta3
→
4.0.9
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 | |
| @@ -49,16 +33,13 @@ | ||
| 49 | 33 | |
| 50 | 34 | $renderer->register( $name, $path ); |
| 51 | 35 | } |
| 52 | 36 | |
| 53 | - $settings = $this->get_atomic_settings(); | |
| 54 | - | |
| 55 | 37 | $context = [ |
| 56 | 38 | 'id' => $this->get_id(), |
| 57 | 39 | 'interaction_id' => $this->get_interaction_id(), |
| 58 | 40 | 'type' => $this->get_name(), |
| 59 | - 'settings' => $settings, | |
| 60 | - 'tag' => static::get_computed_html_tag( $settings ), | |
| 41 | + 'settings' => $this->get_atomic_settings(), | |
| 61 | 42 | 'base_styles' => $this->get_base_styles_dictionary(), |
| 62 | 43 | ]; |
| 63 | 44 | |
| 64 | 45 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| @@ -72,9 +53,9 @@ | ||
| 72 | 53 | |
| 73 | 54 | protected function get_templates_contents() { |
| 74 | 55 | return array_map( |
| 75 | 56 | fn ( $path ) => Utils::file_get_contents( $path ), |
| 76 | - array_merge( $this->get_shared_templates(), $this->get_templates() ) | |
| 57 | + $this->get_templates() | |
| 77 | 58 | ); |
| 78 | 59 | } |
| 79 | 60 | |
| 80 | 61 | protected function get_main_template() { |