dff720ade6169bc0a60d6febe5623bfe07ea1ac0c971020e27be33916124f114.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /* partials/langswitcher.html.twig */
  3. class __TwigTemplate_105e06089d11bf0c86e4fc38effccc162146e8ad80c0e13b5d8b7d514dcfbc3f extends Twig_Template
  4. {
  5. public function __construct(Twig_Environment $env)
  6. {
  7. parent::__construct($env);
  8. $this->parent = false;
  9. $this->blocks = array(
  10. );
  11. }
  12. protected function doDisplay(array $context, array $blocks = array())
  13. {
  14. // line 1
  15. echo "<ul class=\"langswitcher\">
  16. ";
  17. // line 2
  18. $context['_parent'] = $context;
  19. $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["langswitcher"] ?? null), "languages", array()));
  20. foreach ($context['_seq'] as $context["_key"] => $context["language"]) {
  21. // line 3
  22. echo "
  23. ";
  24. // line 4
  25. $context["show_language"] = true;
  26. // line 5
  27. echo " ";
  28. if (($context["language"] == $this->getAttribute(($context["langswitcher"] ?? null), "current", array()))) {
  29. // line 6
  30. echo " ";
  31. $context["lang_url"] = $this->getAttribute(($context["page"] ?? null), "url", array());
  32. // line 7
  33. echo " ";
  34. $context["active_class"] = " active";
  35. // line 8
  36. echo " ";
  37. } else {
  38. // line 9
  39. echo " ";
  40. $context["base_lang_url"] = (($context["base_url_simple"] ?? null) . $this->getAttribute($this->getAttribute(($context["grav"] ?? null), "language", array()), "getLanguageURLPrefix", array(0 => $context["language"]), "method"));
  41. // line 10
  42. echo " ";
  43. $context["lang_url"] = ((($context["base_lang_url"] ?? null) . $this->getAttribute(($context["langswitcher"] ?? null), "page_route", array())) . $this->getAttribute(($context["page"] ?? null), "urlExtension", array()));
  44. // line 11
  45. echo " ";
  46. $context["untranslated_pages_behavior"] = $this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute(($context["grav"] ?? null), "config", array()), "plugins", array()), "langswitcher", array()), "untranslated_pages_behavior", array());
  47. // line 12
  48. echo " ";
  49. if ((($context["untranslated_pages_behavior"] ?? null) != "none")) {
  50. // line 13
  51. echo " ";
  52. $context["translated_page"] = $this->getAttribute($this->getAttribute(($context["langswitcher"] ?? null), "translated_pages", array()), $context["language"], array(), "array");
  53. // line 14
  54. echo " ";
  55. if (( !($context["translated_page"] ?? null) || !$this->getAttribute(($context["translated_page"] ?? null), "published", array()))) {
  56. // line 15
  57. echo " ";
  58. if ((($context["untranslated_pages_behavior"] ?? null) == "redirect")) {
  59. // line 16
  60. echo " ";
  61. $context["lang_url"] = (($context["base_lang_url"] ?? null) . "/");
  62. // line 17
  63. echo " ";
  64. } elseif ((($context["untranslated_pages_behavior"] ?? null) == "hide")) {
  65. // line 18
  66. echo " ";
  67. $context["show_language"] = false;
  68. // line 19
  69. echo " ";
  70. }
  71. // line 20
  72. echo " ";
  73. }
  74. // line 21
  75. echo " ";
  76. }
  77. // line 22
  78. echo " ";
  79. $context["active_class"] = "";
  80. // line 23
  81. echo " ";
  82. }
  83. // line 24
  84. echo "
  85. ";
  86. // line 25
  87. if (($context["show_language"] ?? null)) {
  88. // line 26
  89. echo " <li><a href=\"";
  90. echo (($context["lang_url"] ?? null) . $this->getAttribute(($context["uri"] ?? null), "params", array()));
  91. echo "\" class=\"external";
  92. echo ($context["active_class"] ?? null);
  93. echo "\">";
  94. echo twig_capitalize_string_filter($this->env, call_user_func_array($this->env->getFunction('native_name')->getCallable(), array($context["language"])));
  95. echo "</a></li>
  96. ";
  97. }
  98. // line 28
  99. echo "
  100. ";
  101. }
  102. $_parent = $context['_parent'];
  103. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['language'], $context['_parent'], $context['loop']);
  104. $context = array_intersect_key($context, $_parent) + $_parent;
  105. // line 30
  106. echo "</ul>
  107. ";
  108. }
  109. public function getTemplateName()
  110. {
  111. return "partials/langswitcher.html.twig";
  112. }
  113. public function isTraitable()
  114. {
  115. return false;
  116. }
  117. public function getDebugInfo()
  118. {
  119. return array ( 110 => 30, 103 => 28, 93 => 26, 91 => 25, 88 => 24, 85 => 23, 82 => 22, 79 => 21, 76 => 20, 73 => 19, 70 => 18, 67 => 17, 64 => 16, 61 => 15, 58 => 14, 55 => 13, 52 => 12, 49 => 11, 46 => 10, 43 => 9, 40 => 8, 37 => 7, 34 => 6, 31 => 5, 29 => 4, 26 => 3, 22 => 2, 19 => 1,);
  120. }
  121. /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
  122. public function getSource()
  123. {
  124. @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
  125. return $this->getSourceContext()->getCode();
  126. }
  127. public function getSourceContext()
  128. {
  129. return new Twig_Source("<ul class=\"langswitcher\">
  130. {% for language in langswitcher.languages %}
  131. {% set show_language = true %}
  132. {% if language == langswitcher.current %}
  133. {% set lang_url = page.url %}
  134. {% set active_class = ' active' %}
  135. {% else %}
  136. {% set base_lang_url = base_url_simple ~ grav.language.getLanguageURLPrefix(language) %}
  137. {% set lang_url = base_lang_url ~ langswitcher.page_route ~ page.urlExtension %}
  138. {% set untranslated_pages_behavior = grav.config.plugins.langswitcher.untranslated_pages_behavior %}
  139. {% if untranslated_pages_behavior != 'none' %}
  140. {% set translated_page = langswitcher.translated_pages[language] %}
  141. {% if (not translated_page) or (not translated_page.published) %}
  142. {% if untranslated_pages_behavior == 'redirect' %}
  143. {% set lang_url = base_lang_url ~ '/' %}
  144. {% elseif untranslated_pages_behavior == 'hide' %}
  145. {% set show_language = false %}
  146. {% endif %}
  147. {% endif %}
  148. {% endif %}
  149. {% set active_class = '' %}
  150. {% endif %}
  151. {% if show_language %}
  152. <li><a href=\"{{ lang_url ~ uri.params }}\" class=\"external{{ active_class }}\">{{ native_name(language)|capitalize }}</a></li>
  153. {% endif %}
  154. {% endfor %}
  155. </ul>
  156. ", "partials/langswitcher.html.twig", "/home/kevin/Sites/static-ethica.net/user/plugins/langswitcher/templates/partials/langswitcher.html.twig");
  157. }
  158. }