PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev1
Elementor Website Builder – more than just a page builder v3.28.0-dev1
4.3.0-beta3 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 All 452 releases
elementor / vendor_prefixed / twig / src / TemplateWrapper.php

TemplateWrapper.php in Elementor Website Builder – more than just a page builder 3.28.0-dev1, at vendor_prefixed/twig/src/TemplateWrapper.php

83 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace ElementorDeps\Twig;
12
13 /**
14 * Exposes a template to userland.
15 *
16 * @author Fabien Potencier <fabien@symfony.com>
17 */
18 final class TemplateWrapper
19 {
20 private $env;
21 private $template;
22 /**
23 * This method is for internal use only and should never be called
24 * directly (use Twig\Environment::load() instead).
25 *
26 * @internal
27 */
28 public function __construct(Environment $env, Template $template)
29 {
30 $this->env = $env;
31 $this->template = $template;
32 }
33 public function render(array $context = []) : string
34 {
35 return $this->template->render($context);
36 }
37 public function display(array $context = [])
38 {
39 // using func_get_args() allows to not expose the blocks argument
40 // as it should only be used by internal code
41 $this->template->display($context, \func_get_args()[1] ?? []);
42 }
43 public function hasBlock(string $name, array $context = []) : bool
44 {
45 return $this->template->hasBlock($name, $context);
46 }
47 /**
48 * @return string[] An array of defined template block names
49 */
50 public function getBlockNames(array $context = []) : array
51 {
52 return $this->template->getBlockNames($context);
53 }
54 public function renderBlock(string $name, array $context = []) : string
55 {
56 return $this->template->renderBlock($name, $this->env->mergeGlobals($context));
57 }
58 public function displayBlock(string $name, array $context = [])
59 {
60 $context = $this->env->mergeGlobals($context);
61 foreach ($this->template->yieldBlock($name, $context) as $data) {
62 echo $data;
63 }
64 }
65 public function getSourceContext() : Source
66 {
67 return $this->template->getSourceContext();
68 }
69 public function getTemplateName() : string
70 {
71 return $this->template->getTemplateName();
72 }
73 /**
74 * @internal
75 *
76 * @return Template
77 */
78 public function unwrap()
79 {
80 return $this->template;
81 }
82 }
83