var/cache/dev/twig/a6/a6f6a71a8d624b5c477d3d0e6670c2841c805d6b0b784c85bc0778840467c7e6.php line 76

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. use Twig\TemplateWrapper;
  15. /* app/partials/_canonicals.html.twig */
  16. class __TwigTemplate_63dec12142b0e3147dcd7d47915d2a4be6e74209ab14d4a343b690e68ca3d18c extends Template
  17. {
  18.     private Source $source;
  19.     /**
  20.      * @var array<string, Template>
  21.      */
  22.     private array $macros = [];
  23.     public function __construct(Environment $env)
  24.     {
  25.         parent::__construct($env);
  26.         $this->source $this->getSourceContext();
  27.         $this->parent false;
  28.         $this->blocks = [
  29.         ];
  30.         $this->sandbox $this->extensions[SandboxExtension::class];
  31.         $this->checkSecurity();
  32.     }
  33.     protected function doDisplay(array $context, array $blocks = []): iterable
  34.     {
  35.         $macros $this->macros;
  36.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  37.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""app/partials/_canonicals.html.twig"));
  38.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  39.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""app/partials/_canonicals.html.twig"));
  40.         // line 4
  41.         yield "
  42. <link rel=\"canonical\" href=\"";
  43.         // line 5
  44.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl((((CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method"falsetruetrue5), "url", [], "any"truetruetrue5) &&  !(null === CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method"falsetruetrue5), "url", [], "any"falsefalsetrue5)))) ? (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, ($context["document"] ?? null), "getProperty", ["canonical"], "method"falsetruetrue5), "url", [], "any"falsefalsetrue5)) : (CoreExtension::getAttribute($this->env$this->source, (isset($context["document"]) || array_key_exists("document"$context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.'5$this->source); })()), "url", [], "any"falsefalsetrue5)))), "html"nulltrue);
  45.         yield "\"/>
  46. ";
  47.         // line 7
  48.         if (((((CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"truetruetrue7) &&  !(null === CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"falsefalsetrue7)))) ? (CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"falsefalsetrue7)) : (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::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"falsefalsetrue7), "locale", [], "any"falsefalsetrue7))) == "en-gb")) {
  49.             // line 8
  50.             yield "    <link rel=\"alternate\" href=\"";
  51.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed(CoreExtension::getAttribute($this->env$this->source, (isset($context["document"]) || array_key_exists("document"$context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.'8$this->source); })()), "url", [], "any"falsefalsetrue8), 8$this->source)), "html"nulltrue);
  52.             yield "\" hreflang=\"x-default\"/>
  53. ";
  54.         }
  55.         // line 10
  56.         yield "<link rel=\"alternate\" href=\"";
  57.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed(CoreExtension::getAttribute($this->env$this->source, (isset($context["document"]) || array_key_exists("document"$context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.'10$this->source); })()), "url", [], "any"falsefalsetrue10), 10$this->source)), "html"nulltrue);
  58.         yield "\" hreflang=\"";
  59.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::replace((((CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"truetruetrue10) &&  !(null === CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"falsefalsetrue10)))) ? (CoreExtension::getAttribute($this->env$this->source, ($context["page"] ?? null), "lang", [], "any"falsefalsetrue10)) : (CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'10$this->source); })()), "request", [], "any"falsefalsetrue10), "locale", [], "any"falsefalsetrue10))), ["en-gb" => "en"]), "html"nulltrue);
  60.         yield "\"/>
  61. <!-- get_rel_alternate() -->
  62. ";
  63.         // line 13
  64.         $context['_parent'] = $context;
  65.         $context['_seq'] = CoreExtension::ensureTraversable($this->extensions['App\Twig\LanguageSwitcherExtension']->getRelAlternate((isset($context["document"]) || array_key_exists("document"$context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.'13$this->source); })())));
  66.         foreach ($context['_seq'] as $context["lang"] => $context["url"]) {
  67.             // line 14
  68.             yield "    ";
  69.             if (($context["lang"] == "en-gb")) {
  70.                 // line 15
  71.                 yield "        <link rel=\"alternate\" href=\"";
  72.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed($context["url"], 15$this->source)), "html"nulltrue);
  73.                 yield "\" hreflang=\"x-default\"/>
  74.     ";
  75.             }
  76.             // line 17
  77.             yield "    <link rel=\"alternate\" href=\"";
  78.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['App\Twig\UrlExtension']->trimUrl($this->sandbox->ensureToStringAllowed($context["url"], 17$this->source)), "html"nulltrue);
  79.             yield "\" hreflang=\"";
  80.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::replace($this->sandbox->ensureToStringAllowed($context["lang"], 17$this->source), ["en-gb" => "en"]), "html"nulltrue);
  81.             yield "\"/>
  82. ";
  83.         }
  84.         $_parent $context['_parent'];
  85.         unset($context['_seq'], $context['lang'], $context['url'], $context['_parent']);
  86.         $context array_intersect_key($context$_parent) + $_parent;
  87.         
  88.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  89.         
  90.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  91.         yield from [];
  92.     }
  93.     /**
  94.      * @codeCoverageIgnore
  95.      */
  96.     public function getTemplateName(): string
  97.     {
  98.         return "app/partials/_canonicals.html.twig";
  99.     }
  100.     /**
  101.      * @codeCoverageIgnore
  102.      */
  103.     public function isTraitable(): bool
  104.     {
  105.         return false;
  106.     }
  107.     /**
  108.      * @codeCoverageIgnore
  109.      */
  110.     public function getDebugInfo(): array
  111.     {
  112.         return array (  88 => 17,  82 => 15,  79 => 14,  75 => 13,  66 => 10,  60 => 8,  58 => 7,  53 => 5,  50 => 4,);
  113.     }
  114.     public function getSourceContext(): Source
  115.     {
  116.         return new Source("{# Adds canonical for the current page, check if a document property is set named canonical, if not use url of document
  117. Add alternate links for current page as well as for all the possible translations that are set in pimcore.
  118. as the language en-gb is both a audience page as well as the default we add the x-default tag on top of the alternate hreflang=lang #}
  119. <link rel=\"canonical\" href=\"{{ (document.getProperty('canonical').url ?? document.url) | trimUrl }}\"/>
  120. {% if page.lang ?? app.request.locale == \"en-gb\" %}
  121.     <link rel=\"alternate\" href=\"{{ document.url | trimUrl }}\" hreflang=\"x-default\"/>
  122. {% endif %}
  123. <link rel=\"alternate\" href=\"{{ document.url | trimUrl }}\" hreflang=\"{{ (page.lang ?? app.request.locale) | replace({'en-gb': 'en'}) }}\"/>
  124. <!-- get_rel_alternate() -->
  125. {% for lang, url in get_rel_alternate(document) %}
  126.     {% if lang == \"en-gb\" %}
  127.         <link rel=\"alternate\" href=\"{{ url | trimUrl }}\" hreflang=\"x-default\"/>
  128.     {% endif %}
  129.     <link rel=\"alternate\" href=\"{{ url | trimUrl }}\" hreflang=\"{{ lang | replace({'en-gb': 'en'})  }}\"/>
  130. {% endfor %}
  131. ""app/partials/_canonicals.html.twig""/home/forge/testing.coolworld.ptchr.dev/templates/app/partials/_canonicals.html.twig");
  132.     }
  133.     
  134.     public function checkSecurity()
  135.     {
  136.         static $tags = ["if" => 7"for" => 13];
  137.         static $filters = ["escape" => 5"trimUrl" => 5"replace" => 10];
  138.         static $functions = ["get_rel_alternate" => 13];
  139.         try {
  140.             $this->sandbox->checkSecurity(
  141.                 ['if''for'],
  142.                 ['escape''trimUrl''replace'],
  143.                 ['get_rel_alternate'],
  144.                 $this->source
  145.             );
  146.         } catch (SecurityError $e) {
  147.             $e->setSourceContext($this->source);
  148.             if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
  149.                 $e->setTemplateLine($tags[$e->getTagName()]);
  150.             } elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
  151.                 $e->setTemplateLine($filters[$e->getFilterName()]);
  152.             } elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
  153.                 $e->setTemplateLine($functions[$e->getFunctionName()]);
  154.             }
  155.             throw $e;
  156.         }
  157.     }
  158. }