<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* front/layout/languages.html.twig */
class __TwigTemplate_9b7b5f61c5318f07c00220d2caba5cd9 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "front/layout/languages.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "front/layout/languages.html.twig"));
// line 1
yield "<div class=\"languages\">
";
// line 2
if ( !array_key_exists("language", $context)) {
// line 3
yield " ";
$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);
} else {
// line 5
yield " ";
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);
yield "
";
}
// line 7
$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);
// line 8
$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);
// line 9
if ((isset($context["params"]) || array_key_exists("params", $context) ? $context["params"] : (function () { throw new RuntimeError('Variable "params" does not exist.', 9, $this->source); })())) {
// line 10
yield " ";
$context['_parent'] = $context;
$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); })()));
$context['loop'] = [
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
];
if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
$length = count($context['_seq']);
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context["_key"] => $context["locale"]) {
// line 11
yield " ";
if ( !CoreExtension::getAttribute($this->env, $this->source, $context["loop"], "first", [], "any", false, false, false, 11)) {
yield "|";
}
// line 12
yield " ";
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))) {
// line 13
yield " ";
if (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 13, $this->source); })()) == "product")) {
// line 14
yield " ";
$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);
// line 15
yield " ";
$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)]);
// line 16
yield " ";
} 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"))) {
// line 17
yield " ";
$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);
// line 18
yield " ";
$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)]);
// line 19
yield " ";
} elseif (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 19, $this->source); })()) == "page")) {
// line 20
yield " ";
$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);
// line 21
yield " ";
$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)]);
// line 22
yield " ";
} elseif (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 22, $this->source); })()) == "manufacturer")) {
// line 23
yield " ";
$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);
// line 24
yield " ";
$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)]);
// line 25
yield " ";
} else {
// line 26
yield " ";
$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"]]);
// line 27
yield " ";
}
// line 28
yield " ";
$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); })()));
// line 29
yield " <a href=\"";
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);
yield "\" onclick=\"document.location = atob('";
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);
yield "'); return false;\">";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["locale"], "html", null, true);
yield "</a>
";
} else {
// line 31
yield " <span>";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["locale"], "html", null, true);
yield "</span>
";
}
// line 33
yield " ";
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if (isset($context['loop']['length'])) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['locale'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
}
// line 35
yield "</div>";
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
return; yield '';
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName()
{
return "front/layout/languages.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable()
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo()
{
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,);
}
public function getSourceContext()
{
return new Source("<div class=\"languages\">
{% if language is not defined %}
{% set language = languageMgr.getCurrentLanguage() %}
{% else %}
{{ languageMgr.switchTo(language) }}
{% endif %}
{% set route = app.request.attributes.get('_route') %}
{% set params = app.request.attributes.get('_route_params') %}
{% if params %}
{% for locale in locales %}
{% if not loop.first %}|{% endif %}
{% if locale != app.request.locale %}
{% if route == 'product' %}
{% set descr = product.getProductDescription(locale) %}
{% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
{% elseif (route == 'category') or (route == 'universe') %}
{% set descr = category.getCategoryDescription(locale) %}
{% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
{% elseif route == 'page' %}
{% set descr = page.getPageDescription(locale) %}
{% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
{% elseif route == 'manufacturer' %}
{% set descr = manufacturer.getManufacturerDescription(locale) %}
{% set params = params|merge({'_locale': locale, 'url':descr.url}) %}
{% else %}
{% set params = params|merge({'_locale': locale}) %}
{% endif %}
{% set redirect = path(route, params) %}
<a href=\"{{ redirect }}\" onclick=\"document.location = atob('{{ path('change_locale',{_locale:locale,redirect:redirect})|raw|base64_encode }}'); return false;\">{{ locale }}</a>
{% else %}
<span>{{ locale }}</span>
{% endif %}
{% endfor %}
{% endif %}
</div>", "front/layout/languages.html.twig", "/var/www/dogcat.com/v2-test/templates/front/layout/languages.html.twig");
}
}