721bda27f6c7963a7ceed98b3ea94dd2804f33e40520412dcd1cf01f340ed146.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <?php
  2. /* forms/fields/tabs/tabs.html.twig */
  3. class __TwigTemplate_376c579fd13500c86998097d3eec40eabf874c773008bfd0b68a1f9a4be0e169 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 "<div class=\"form-tabs ";
  16. echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "class", array()), "html", null, true);
  17. echo " ";
  18. echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "classes", array()), "html", null, true);
  19. echo "\">
  20. ";
  21. // line 3
  22. if ($this->getAttribute(($context["field"] ?? null), "fields", array())) {
  23. // line 4
  24. echo "
  25. ";
  26. // line 5
  27. $context["tabsKey"] = twig_join_filter(twig_get_array_keys_filter($this->getAttribute(($context["field"] ?? null), "fields", array())), ".");
  28. // line 6
  29. echo " ";
  30. $context["storedValue"] = $this->env->getExtension('Grav\Common\Twig\TwigExtension')->jsonDecodeFilter(_twig_default_filter($this->env->getExtension('Grav\Common\Twig\TwigExtension')->getCookie("grav-tabs-state"), "{}"));
  31. // line 7
  32. echo " ";
  33. $context["storedTab"] = $this->getAttribute(($context["storedValue"] ?? null), ("tab-" . ($context["tabsKey"] ?? null)));
  34. // line 8
  35. echo "
  36. ";
  37. // line 9
  38. if (twig_test_empty(($context["storedTab"] ?? null))) {
  39. // line 10
  40. echo " ";
  41. if ($this->getAttribute($this->getAttribute(($context["uri"] ?? null), "params", array()), "tab", array())) {
  42. // line 11
  43. echo " ";
  44. $context["active"] = $this->getAttribute($this->getAttribute(($context["uri"] ?? null), "params", array()), "tab", array());
  45. // line 12
  46. echo " ";
  47. } elseif ($this->getAttribute(($context["field"] ?? null), "active", array())) {
  48. // line 13
  49. echo " ";
  50. $context["active"] = $this->getAttribute(($context["field"] ?? null), "active", array());
  51. // line 14
  52. echo " ";
  53. } else {
  54. // line 15
  55. echo " ";
  56. $context["active"] = 1;
  57. // line 16
  58. echo " ";
  59. }
  60. // line 17
  61. echo " ";
  62. }
  63. // line 18
  64. echo "
  65. <div class=\"tabs-nav\">
  66. ";
  67. // line 20
  68. $context['_parent'] = $context;
  69. $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "fields", array()));
  70. $context['loop'] = array(
  71. 'parent' => $context['_parent'],
  72. 'index0' => 0,
  73. 'index' => 1,
  74. 'first' => true,
  75. );
  76. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
  77. $length = count($context['_seq']);
  78. $context['loop']['revindex0'] = $length - 1;
  79. $context['loop']['revindex'] = $length;
  80. $context['loop']['length'] = $length;
  81. $context['loop']['last'] = 1 === $length;
  82. }
  83. foreach ($context['_seq'] as $context["_key"] => $context["tab"]) {
  84. // line 21
  85. echo " ";
  86. if ((($this->getAttribute($context["tab"], "type", array()) == "tab") && (twig_test_empty($this->getAttribute($context["tab"], "security", array())) || $this->env->getExtension('Grav\Common\Twig\TwigExtension')->authorize($this->env->getExtension('Grav\Common\Twig\TwigExtension')->arrayFunc($this->getAttribute($context["tab"], "security", array())))))) {
  87. // line 22
  88. echo " <a class=\"tab__link ";
  89. echo ((((($context["storedTab"] ?? null) == (($context["scope"] ?? null) . $this->getAttribute($context["tab"], "name", array()))) || (($context["active"] ?? null) == $this->getAttribute($context["loop"], "index", array())))) ? ("active") : (""));
  90. echo "\" href=\"#\" data-tabid=\"tab-";
  91. echo twig_escape_filter($this->env, (($context["tabsKey"] ?? null) . $this->getAttribute($context["loop"], "index", array())), "html", null, true);
  92. echo "\" data-tabkey=\"tab-";
  93. echo twig_escape_filter($this->env, ($context["tabsKey"] ?? null), "html", null, true);
  94. echo "\" data-scope=\"";
  95. echo twig_escape_filter($this->env, (($context["scope"] ?? null) . $this->getAttribute($context["tab"], "name", array())), "html", null, true);
  96. echo "\">
  97. <span>
  98. ";
  99. // line 24
  100. if ($this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute(($context["grav"] ?? null), "twig", array(), "any", false, true), "twig", array(), "any", false, true), "filters", array(), "any", false, true), "tu", array(), "array", true, true)) {
  101. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter($this->getAttribute($context["tab"], "title", array())), "html", null, true);
  102. } else {
  103. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->translate($this->getAttribute($context["tab"], "title", array())), "html", null, true);
  104. }
  105. // line 25
  106. echo " </span>
  107. </a>
  108. ";
  109. }
  110. // line 28
  111. echo " ";
  112. ++$context['loop']['index0'];
  113. ++$context['loop']['index'];
  114. $context['loop']['first'] = false;
  115. if (isset($context['loop']['length'])) {
  116. --$context['loop']['revindex0'];
  117. --$context['loop']['revindex'];
  118. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  119. }
  120. }
  121. $_parent = $context['_parent'];
  122. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tab'], $context['_parent'], $context['loop']);
  123. $context = array_intersect_key($context, $_parent) + $_parent;
  124. // line 29
  125. echo " </div>
  126. <div class=\"tabs-content\">
  127. ";
  128. // line 31
  129. $context['_parent'] = $context;
  130. $context['_seq'] = twig_ensure_traversable($this->getAttribute($context["field"], "fields", array()));
  131. $context['loop'] = array(
  132. 'parent' => $context['_parent'],
  133. 'index0' => 0,
  134. 'index' => 1,
  135. 'first' => true,
  136. );
  137. if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) {
  138. $length = count($context['_seq']);
  139. $context['loop']['revindex0'] = $length - 1;
  140. $context['loop']['revindex'] = $length;
  141. $context['loop']['length'] = $length;
  142. $context['loop']['last'] = 1 === $length;
  143. }
  144. foreach ($context['_seq'] as $context["_key"] => $context["field"]) {
  145. // line 32
  146. echo " ";
  147. if (($this->getAttribute($context["field"], "type", array()) == "tab")) {
  148. // line 33
  149. echo " ";
  150. if ((twig_test_empty($this->getAttribute($context["field"], "security", array())) || $this->env->getExtension('Grav\Common\Twig\TwigExtension')->authorize($this->env->getExtension('Grav\Common\Twig\TwigExtension')->arrayFunc($this->getAttribute($context["field"], "security", array()))))) {
  151. // line 34
  152. echo " ";
  153. $context["value"] = (($this->getAttribute($context["field"], "name", array())) ? ($this->getAttribute(($context["data"] ?? null), "value", array(0 => $this->getAttribute($context["field"], "name", array())), "method")) : ($this->getAttribute(($context["data"] ?? null), "toArray", array())));
  154. // line 35
  155. echo " <div id=\"tab-";
  156. echo twig_escape_filter($this->env, (($context["tabsKey"] ?? null) . $this->getAttribute($context["loop"], "index", array())), "html", null, true);
  157. echo "\" class=\"tab__content ";
  158. echo ((((($context["storedTab"] ?? null) == (($context["scope"] ?? null) . $this->getAttribute($context["field"], "name", array()))) || (($context["active"] ?? null) == $this->getAttribute($context["loop"], "index", array())))) ? ("active") : (""));
  159. echo "\">
  160. ";
  161. // line 36
  162. $this->loadTemplate(array(0 => (((("forms/fields/" . $this->getAttribute($context["field"], "type", array())) . "/") . $this->getAttribute($context["field"], "type", array())) . ".html.twig"), 1 => "forms/fields/text/text.html.twig"), "forms/fields/tabs/tabs.html.twig", 36)->display($context);
  163. // line 37
  164. echo " </div>
  165. ";
  166. }
  167. // line 39
  168. echo " ";
  169. }
  170. // line 40
  171. echo " ";
  172. ++$context['loop']['index0'];
  173. ++$context['loop']['index'];
  174. $context['loop']['first'] = false;
  175. if (isset($context['loop']['length'])) {
  176. --$context['loop']['revindex0'];
  177. --$context['loop']['revindex'];
  178. $context['loop']['last'] = 0 === $context['loop']['revindex0'];
  179. }
  180. }
  181. $_parent = $context['_parent'];
  182. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['field'], $context['_parent'], $context['loop']);
  183. $context = array_intersect_key($context, $_parent) + $_parent;
  184. // line 41
  185. echo " </div>
  186. ";
  187. }
  188. // line 43
  189. echo "</div>
  190. ";
  191. }
  192. public function getTemplateName()
  193. {
  194. return "forms/fields/tabs/tabs.html.twig";
  195. }
  196. public function isTraitable()
  197. {
  198. return false;
  199. }
  200. public function getDebugInfo()
  201. {
  202. return array ( 194 => 43, 190 => 41, 176 => 40, 173 => 39, 169 => 37, 167 => 36, 160 => 35, 157 => 34, 154 => 33, 151 => 32, 134 => 31, 130 => 29, 116 => 28, 111 => 25, 105 => 24, 93 => 22, 90 => 21, 73 => 20, 69 => 18, 66 => 17, 63 => 16, 60 => 15, 57 => 14, 54 => 13, 51 => 12, 48 => 11, 45 => 10, 43 => 9, 40 => 8, 37 => 7, 34 => 6, 32 => 5, 29 => 4, 27 => 3, 19 => 1,);
  203. }
  204. /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
  205. public function getSource()
  206. {
  207. @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
  208. return $this->getSourceContext()->getCode();
  209. }
  210. public function getSourceContext()
  211. {
  212. return new Twig_Source("<div class=\"form-tabs {{ field.class }} {{ field.classes }}\">
  213. {% if field.fields %}
  214. {% set tabsKey = field.fields|keys|join('.') %}
  215. {% set storedValue = get_cookie('grav-tabs-state')|default('{}')|json_decode %}
  216. {% set storedTab = attribute(storedValue, 'tab-' ~ tabsKey) %}
  217. {% if storedTab is empty %}
  218. {% if uri.params.tab %}
  219. {% set active = uri.params.tab %}
  220. {% elseif field.active %}
  221. {% set active = field.active %}
  222. {% else %}
  223. {% set active = 1 %}
  224. {% endif %}
  225. {% endif %}
  226. <div class=\"tabs-nav\">
  227. {% for tab in field.fields %}
  228. {% if tab.type == 'tab' and (tab.security is empty or authorize(array(tab.security))) %}
  229. <a class=\"tab__link {{ (storedTab == scope ~ tab.name) or active == loop.index ? 'active' : '' }}\" href=\"#\" data-tabid=\"tab-{{ tabsKey ~ loop.index }}\" data-tabkey=\"tab-{{ tabsKey }}\" data-scope=\"{{ scope ~ tab.name }}\">
  230. <span>
  231. {% if grav.twig.twig.filters['tu'] is defined %}{{ tab.title|tu }}{% else %}{{ tab.title|t }}{% endif %}
  232. </span>
  233. </a>
  234. {% endif %}
  235. {% endfor %}
  236. </div>
  237. <div class=\"tabs-content\">
  238. {% for field in field.fields %}
  239. {% if field.type == 'tab' %}
  240. {% if field.security is empty or authorize(array(field.security)) %}
  241. {% set value = field.name ? data.value(field.name) : data.toArray %}
  242. <div id=\"tab-{{ tabsKey ~ loop.index }}\" class=\"tab__content {{ (storedTab == scope ~ field.name) or active == loop.index ? 'active' : '' }}\">
  243. {% include [\"forms/fields/#{field.type}/#{field.type}.html.twig\", 'forms/fields/text/text.html.twig'] %}
  244. </div>
  245. {% endif %}
  246. {% endif %}
  247. {% endfor %}
  248. </div>
  249. {% endif %}
  250. </div>
  251. ", "forms/fields/tabs/tabs.html.twig", "/mnt/data/Sites/static-ethica.net/user/plugins/admin/themes/grav/templates/forms/fields/tabs/tabs.html.twig");
  252. }
  253. }