var/cache/dev/twig/36/36b1951f4c08aa9acbb86e68f1236285.php line 34

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\CoreExtension;
  6. use Twig\Extension\SandboxExtension;
  7. use Twig\Markup;
  8. use Twig\Sandbox\SecurityError;
  9. use Twig\Sandbox\SecurityNotAllowedTagError;
  10. use Twig\Sandbox\SecurityNotAllowedFilterError;
  11. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  12. use Twig\Source;
  13. use Twig\Template;
  14. /* front/layout/languages.html.twig */
  15. class __TwigTemplate_9b7b5f61c5318f07c00220d2caba5cd9 extends Template
  16. {
  17. private $source;
  18. private $macros = [];
  19. public function __construct(Environment $env)
  20. {
  21. parent::__construct($env);
  22. $this->source = $this->getSourceContext();
  23. $this->parent = false;
  24. $this->blocks = [
  25. ];
  26. }
  27. protected function doDisplay(array $context, array $blocks = [])
  28. {
  29. $macros = $this->macros;
  30. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  31. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "front/layout/languages.html.twig"));
  32. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  33. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "front/layout/languages.html.twig"));
  34. // line 1
  35. yield "<div class=\"languages\">
  36. ";
  37. // line 2
  38. if ( !array_key_exists("language", $context)) {
  39. // line 3
  40. yield " ";
  41. $context["language"] = CoreExtension::getAttribute($this->env, $this->source, (isset($context["languageMgr"]) || array_key_exists("languageMgr", $context) ? $context["languageMgr"] : (function () { throw new RuntimeError('Variable "languageMgr" does not exist.', 3, $this->source); })()), "getCurrentLanguage", [], "method", false, false, false, 3);
  42. } else {
  43. // line 5
  44. yield " ";
  45. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["languageMgr"]) || array_key_exists("languageMgr", $context) ? $context["languageMgr"] : (function () { throw new RuntimeError('Variable "languageMgr" does not exist.', 5, $this->source); })()), "switchTo", [(isset($context["language"]) || array_key_exists("language", $context) ? $context["language"] : (function () { throw new RuntimeError('Variable "language" does not exist.', 5, $this->source); })())], "method", false, false, false, 5), "html", null, true);
  46. yield "
  47. ";
  48. }
  49. // line 7
  50. $context["route"] = CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 7, $this->source); })()), "request", [], "any", false, false, false, 7), "attributes", [], "any", false, false, false, 7), "get", ["_route"], "method", false, false, false, 7);
  51. // line 8
  52. $context["params"] = CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 8, $this->source); })()), "request", [], "any", false, false, false, 8), "attributes", [], "any", false, false, false, 8), "get", ["_route_params"], "method", false, false, false, 8);
  53. // line 9
  54. if ((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 9, $this->source); })())) {
  55. // line 10
  56. yield " ";
  57. $context['_parent'] = $context;
  58. $context['_seq'] = CoreExtension::ensureTraversable((isset($context["locales"]) || array_key_exists("locales", $context) ? $context["locales"] : (function () { throw new RuntimeError('Variable "locales" does not exist.', 10, $this->source); })()));
  59. $context['loop'] = [
  60. 'parent' => $context['_parent'],
  61. 'index0' => 0,
  62. 'index' => 1,
  63. 'first' => true,
  64. ];
  65. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
  66. $length = count($context['_seq']);
  67. $context['loop']['revindex0'] = $length - 1;
  68. $context['loop']['revindex'] = $length;
  69. $context['loop']['length'] = $length;
  70. $context['loop']['last'] = 1 === $length;
  71. }
  72. foreach ($context['_seq'] as $context["_key"] => $context["locale"]) {
  73. // line 11
  74. yield " ";
  75. if ( !CoreExtension::getAttribute($this->env, $this->source, $context["loop"], "first", [], "any", false, false, false, 11)) {
  76. yield "|";
  77. }
  78. // line 12
  79. yield " ";
  80. if (($context["locale"] != CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 12, $this->source); })()), "request", [], "any", false, false, false, 12), "locale", [], "any", false, false, false, 12))) {
  81. // line 13
  82. yield " ";
  83. if (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 13, $this->source); })()) == "product")) {
  84. // line 14
  85. yield " ";
  86. $context["descr"] = CoreExtension::getAttribute($this->env, $this->source, (isset($context["product"]) || array_key_exists("product", $context) ? $context["product"] : (function () { throw new RuntimeError('Variable "product" does not exist.', 14, $this->source); })()), "getProductDescription", [$context["locale"]], "method", false, false, false, 14);
  87. // line 15
  88. yield " ";
  89. $context["params"] = Twig\Extension\CoreExtension::merge((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 15, $this->source); })()), ["_locale" => $context["locale"], "url" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["descr"]) || array_key_exists("descr", $context) ? $context["descr"] : (function () { throw new RuntimeError('Variable "descr" does not exist.', 15, $this->source); })()), "url", [], "any", false, false, false, 15)]);
  90. // line 16
  91. yield " ";
  92. } elseif ((((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 16, $this->source); })()) == "category") || ((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 16, $this->source); })()) == "universe"))) {
  93. // line 17
  94. yield " ";
  95. $context["descr"] = CoreExtension::getAttribute($this->env, $this->source, (isset($context["category"]) || array_key_exists("category", $context) ? $context["category"] : (function () { throw new RuntimeError('Variable "category" does not exist.', 17, $this->source); })()), "getCategoryDescription", [$context["locale"]], "method", false, false, false, 17);
  96. // line 18
  97. yield " ";
  98. $context["params"] = Twig\Extension\CoreExtension::merge((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 18, $this->source); })()), ["_locale" => $context["locale"], "url" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["descr"]) || array_key_exists("descr", $context) ? $context["descr"] : (function () { throw new RuntimeError('Variable "descr" does not exist.', 18, $this->source); })()), "url", [], "any", false, false, false, 18)]);
  99. // line 19
  100. yield " ";
  101. } elseif (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 19, $this->source); })()) == "page")) {
  102. // line 20
  103. yield " ";
  104. $context["descr"] = CoreExtension::getAttribute($this->env, $this->source, (isset($context["page"]) || array_key_exists("page", $context) ? $context["page"] : (function () { throw new RuntimeError('Variable "page" does not exist.', 20, $this->source); })()), "getPageDescription", [$context["locale"]], "method", false, false, false, 20);
  105. // line 21
  106. yield " ";
  107. $context["params"] = Twig\Extension\CoreExtension::merge((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 21, $this->source); })()), ["_locale" => $context["locale"], "url" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["descr"]) || array_key_exists("descr", $context) ? $context["descr"] : (function () { throw new RuntimeError('Variable "descr" does not exist.', 21, $this->source); })()), "url", [], "any", false, false, false, 21)]);
  108. // line 22
  109. yield " ";
  110. } elseif (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 22, $this->source); })()) == "manufacturer")) {
  111. // line 23
  112. yield " ";
  113. $context["descr"] = CoreExtension::getAttribute($this->env, $this->source, (isset($context["manufacturer"]) || array_key_exists("manufacturer", $context) ? $context["manufacturer"] : (function () { throw new RuntimeError('Variable "manufacturer" does not exist.', 23, $this->source); })()), "getManufacturerDescription", [$context["locale"]], "method", false, false, false, 23);
  114. // line 24
  115. yield " ";
  116. $context["params"] = Twig\Extension\CoreExtension::merge((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 24, $this->source); })()), ["_locale" => $context["locale"], "url" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["descr"]) || array_key_exists("descr", $context) ? $context["descr"] : (function () { throw new RuntimeError('Variable "descr" does not exist.', 24, $this->source); })()), "url", [], "any", false, false, false, 24)]);
  117. // line 25
  118. yield " ";
  119. } else {
  120. // line 26
  121. yield " ";
  122. $context["params"] = Twig\Extension\CoreExtension::merge((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 26, $this->source); })()), ["_locale" => $context["locale"]]);
  123. // line 27
  124. yield " ";
  125. }
  126. // line 28
  127. yield " ";
  128. $context["redirect"] = $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 28, $this->source); })()), (isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 28, $this->source); })()));
  129. // line 29
  130. yield " <a href=\"";
  131. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["redirect"]) || array_key_exists("redirect", $context) ? $context["redirect"] : (function () { throw new RuntimeError('Variable "redirect" does not exist.', 29, $this->source); })()), "html", null, true);
  132. yield "\" onclick=\"document.location = atob('";
  133. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\TextExtension']->base64Encode($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("change_locale", ["_locale" => $context["locale"], "redirect" => (isset($context["redirect"]) || array_key_exists("redirect", $context) ? $context["redirect"] : (function () { throw new RuntimeError('Variable "redirect" does not exist.', 29, $this->source); })())])), "html", null, true);
  134. yield "'); return false;\">";
  135. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["locale"], "html", null, true);
  136. yield "</a>
  137. ";
  138. } else {
  139. // line 31
  140. yield " <span>";
  141. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["locale"], "html", null, true);
  142. yield "</span>
  143. ";
  144. }
  145. // line 33
  146. yield " ";
  147. ++$context['loop']['index0'];
  148. ++$context['loop']['index'];
  149. $context['loop']['first'] = false;
  150. if (isset($context['loop']['length'])) {
  151. --$context['loop']['revindex0'];
  152. --$context['loop']['revindex'];
  153. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  154. }
  155. }
  156. $_parent = $context['_parent'];
  157. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['locale'], $context['_parent'], $context['loop']);
  158. $context = array_intersect_key($context, $_parent) + $_parent;
  159. }
  160. // line 35
  161. yield "</div>";
  162. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  163. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  164. return; yield '';
  165. }
  166. /**
  167. * @codeCoverageIgnore
  168. */
  169. public function getTemplateName()
  170. {
  171. return "front/layout/languages.html.twig";
  172. }
  173. /**
  174. * @codeCoverageIgnore
  175. */
  176. public function isTraitable()
  177. {
  178. return false;
  179. }
  180. /**
  181. * @codeCoverageIgnore
  182. */
  183. public function getDebugInfo()
  184. {
  185. return array ( 170 => 35, 155 => 33, 149 => 31, 139 => 29, 136 => 28, 133 => 27, 130 => 26, 127 => 25, 124 => 24, 121 => 23, 118 => 22, 115 => 21, 112 => 20, 109 => 19, 106 => 18, 103 => 17, 100 => 16, 97 => 15, 94 => 14, 91 => 13, 88 => 12, 83 => 11, 65 => 10, 63 => 9, 61 => 8, 59 => 7, 53 => 5, 49 => 3, 47 => 2, 44 => 1,);
  186. }
  187. public function getSourceContext()
  188. {
  189. return new Source("<div class=\"languages\">
  190. {% if language is not defined %}
  191. {% set language = languageMgr.getCurrentLanguage() %}
  192. {% else %}
  193. {{ languageMgr.switchTo(language) }}
  194. {% endif %}
  195. {% set route = app.request.attributes.get('_route') %}
  196. {% set params = app.request.attributes.get('_route_params') %}
  197. {% if params %}
  198. {% for locale in locales %}
  199. {% if not loop.first %}|{% endif %}
  200. {% if locale != app.request.locale %}
  201. {% if route == 'product' %}
  202. {% set descr = product.getProductDescription(locale) %}
  203. {% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
  204. {% elseif (route == 'category') or (route == 'universe') %}
  205. {% set descr = category.getCategoryDescription(locale) %}
  206. {% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
  207. {% elseif route == 'page' %}
  208. {% set descr = page.getPageDescription(locale) %}
  209. {% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
  210. {% elseif route == 'manufacturer' %}
  211. {% set descr = manufacturer.getManufacturerDescription(locale) %}
  212. {% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
  213. {% else %}
  214. {% set params = params|merge({'_locale': locale}) %}
  215. {% endif %}
  216. {% set redirect = path(route, params) %}
  217. <a href=\"{{ redirect }}\" onclick=\"document.location = atob('{{ path('change_locale',{_locale:locale,redirect:redirect})|raw|base64_encode }}'); return false;\">{{ locale }}</a>
  218. {% else %}
  219. <span>{{ locale }}</span>
  220. {% endif %}
  221. {% endfor %}
  222. {% endif %}
  223. </div>", "front/layout/languages.html.twig", "/var/www/dogcat.com/v2-test/templates/front/layout/languages.html.twig");
  224. }
  225. }