d6af130f63ce9e2af25fb0f151a0d41030afc550f238cea774a510f840ea833d.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <?php
  2. /* forms/fields/toggle/toggle.html.twig */
  3. class __TwigTemplate_c1a99be3cdc53fcee4c61dc15d20e8c48c22c5e53af3058544ed9bc330d82f60 extends Twig_Template
  4. {
  5. public function __construct(Twig_Environment $env)
  6. {
  7. parent::__construct($env);
  8. // line 1
  9. $this->parent = $this->loadTemplate("forms/field.html.twig", "forms/fields/toggle/toggle.html.twig", 1);
  10. $this->blocks = array(
  11. 'global_attributes' => array($this, 'block_global_attributes'),
  12. 'input' => array($this, 'block_input'),
  13. );
  14. }
  15. protected function doGetParent(array $context)
  16. {
  17. return "forms/field.html.twig";
  18. }
  19. protected function doDisplay(array $context, array $blocks = array())
  20. {
  21. // line 3
  22. $context["value"] = (((null === ($context["value"] ?? null))) ? ($this->getAttribute(($context["field"] ?? null), "default", array())) : (($context["value"] ?? null)));
  23. // line 4
  24. $context["value"] = (((($context["value"] ?? null) === false)) ? (0) : (($context["value"] ?? null)));
  25. // line 6
  26. $context["has_hidden"] = false;
  27. // line 7
  28. $context['_parent'] = $context;
  29. $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
  30. foreach ($context['_seq'] as $context["key"] => $context["text"]) {
  31. // line 8
  32. if (twig_test_empty($context["key"])) {
  33. // line 9
  34. $context["has_hidden"] = true;
  35. }
  36. }
  37. $_parent = $context['_parent'];
  38. unset($context['_seq'], $context['_iterated'], $context['key'], $context['text'], $context['_parent'], $context['loop']);
  39. $context = array_intersect_key($context, $_parent) + $_parent;
  40. // line 1
  41. $this->parent->display($context, array_merge($this->blocks, $blocks));
  42. }
  43. // line 13
  44. public function block_global_attributes($context, array $blocks = array())
  45. {
  46. // line 14
  47. echo " ";
  48. $this->displayParentBlock("global_attributes", $context, $blocks);
  49. echo "
  50. data-grav-field-name=\"";
  51. // line 15
  52. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->fieldNameFilter((($context["scope"] ?? null) . $this->getAttribute(($context["field"] ?? null), "name", array()))), "html", null, true);
  53. echo "\"
  54. ";
  55. }
  56. // line 23
  57. public function block_input($context, array $blocks = array())
  58. {
  59. // line 24
  60. echo "
  61. <div class=\"switch-toggle switch-grav ";
  62. // line 25
  63. echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "size", array()), "html", null, true);
  64. echo " switch-";
  65. echo twig_escape_filter($this->env, twig_length_filter($this->env, $this->getAttribute(($context["field"] ?? null), "options", array())), "html", null, true);
  66. echo " ";
  67. echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "classes", array()), "html", null, true);
  68. echo "\">
  69. ";
  70. // line 26
  71. $context["maxLen"] = 0;
  72. // line 27
  73. echo " ";
  74. $context['_parent'] = $context;
  75. $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
  76. foreach ($context['_seq'] as $context["_key"] => $context["text"]) {
  77. // line 28
  78. echo " ";
  79. $context["translation"] = (($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)) ? ($this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter($context["text"])) : ($this->env->getExtension('Grav\Common\Twig\TwigExtension')->translate($context["text"])));
  80. // line 29
  81. echo " ";
  82. $context["maxLen"] = max(twig_length_filter($this->env, ($context["translation"] ?? null)), ($context["maxLen"] ?? null));
  83. // line 30
  84. echo " ";
  85. }
  86. $_parent = $context['_parent'];
  87. unset($context['_seq'], $context['_iterated'], $context['_key'], $context['text'], $context['_parent'], $context['loop']);
  88. $context = array_intersect_key($context, $_parent) + $_parent;
  89. // line 31
  90. echo "
  91. ";
  92. // line 32
  93. $context['_parent'] = $context;
  94. $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
  95. foreach ($context['_seq'] as $context["key"] => $context["text"]) {
  96. // line 33
  97. echo " ";
  98. $context["id"] = (("toggle_" . $this->getAttribute(($context["field"] ?? null), "name", array())) . $context["key"]);
  99. // line 34
  100. echo " ";
  101. $context["translation"] = twig_trim_filter((($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)) ? ($this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter($context["text"])) : ($this->env->getExtension('Grav\Common\Twig\TwigExtension')->translate($context["text"]))));
  102. // line 35
  103. echo "
  104. <input type=\"radio\"
  105. value=\"";
  106. // line 37
  107. echo twig_escape_filter($this->env, $context["key"], "html", null, true);
  108. echo "\"
  109. id=\"";
  110. // line 38
  111. echo twig_escape_filter($this->env, ($context["id"] ?? null), "html", null, true);
  112. echo "\"
  113. name=\"";
  114. // line 39
  115. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->fieldNameFilter((($context["scope"] ?? null) . $this->getAttribute(($context["field"] ?? null), "name", array()))), "html", null, true);
  116. echo "\"
  117. ";
  118. // line 40
  119. if ($this->getAttribute(($context["field"] ?? null), "highlight", array(), "any", true, true)) {
  120. // line 41
  121. echo " class=\"";
  122. echo ((($this->getAttribute(($context["field"] ?? null), "highlight", array()) == ("" . $context["key"]))) ? ("highlight") : (""));
  123. echo "\"
  124. ";
  125. }
  126. // line 43
  127. echo " ";
  128. if (($this->getAttribute(($context["field"] ?? null), "disabled", array()) || ($context["isDisabledToggleable"] ?? null))) {
  129. echo "disabled=\"disabled\"";
  130. }
  131. // line 44
  132. echo " ";
  133. if ($this->getAttribute(($context["field"] ?? null), "toggleable", array())) {
  134. // line 45
  135. echo " ";
  136. if ((("" . $context["key"]) == ("" . ($context["value"] ?? null)))) {
  137. // line 46
  138. echo " checked=\"checked\"
  139. ";
  140. } elseif (( // line 47
  141. array_key_exists("value", $context) && (($context["key"] == 1) || ($context["key"] == "1")))) {
  142. // line 48
  143. echo " checked=\"checked\"
  144. ";
  145. }
  146. // line 50
  147. echo " ";
  148. } else {
  149. // line 51
  150. echo " ";
  151. if ((("" . $context["key"]) == ("" . ($context["value"] ?? null)))) {
  152. // line 52
  153. echo " checked=\"checked\"
  154. ";
  155. }
  156. // line 54
  157. echo " ";
  158. }
  159. // line 55
  160. echo " ";
  161. if (twig_in_filter($this->getAttribute($this->getAttribute(($context["field"] ?? null), "validate", array()), "required", array()), array(0 => "on", 1 => "true", 2 => 1))) {
  162. echo "required=\"required\"";
  163. }
  164. // line 56
  165. echo " />
  166. <label for=\"";
  167. // line 57
  168. echo twig_escape_filter($this->env, ($context["id"] ?? null), "html", null, true);
  169. echo "\">";
  170. echo twig_trim_filter($this->getAttribute($this, "spanToggle", array(0 => ($context["translation"] ?? null), 1 => ($context["maxLen"] ?? null)), "method"));
  171. echo "</label>
  172. ";
  173. }
  174. $_parent = $context['_parent'];
  175. unset($context['_seq'], $context['_iterated'], $context['key'], $context['text'], $context['_parent'], $context['loop']);
  176. $context = array_intersect_key($context, $_parent) + $_parent;
  177. // line 59
  178. echo " </div>
  179. ";
  180. }
  181. // line 18
  182. public function getspanToggle($__input__ = null, $__length__ = null, ...$__varargs__)
  183. {
  184. $context = $this->env->mergeGlobals(array(
  185. "input" => $__input__,
  186. "length" => $__length__,
  187. "varargs" => $__varargs__,
  188. ));
  189. $blocks = array();
  190. ob_start();
  191. try {
  192. // line 19
  193. echo " ";
  194. $context["space"] = $this->env->getExtension('Grav\Common\Twig\TwigExtension')->repeatFunc("&nbsp;&nbsp;", ((($context["length"] ?? null) - twig_length_filter($this->env, ($context["input"] ?? null))) / 2));
  195. // line 20
  196. echo " ";
  197. echo ((($context["space"] ?? null) . ($context["input"] ?? null)) . ($context["space"] ?? null));
  198. echo "
  199. ";
  200. } catch (Exception $e) {
  201. ob_end_clean();
  202. throw $e;
  203. } catch (Throwable $e) {
  204. ob_end_clean();
  205. throw $e;
  206. }
  207. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  208. }
  209. public function getTemplateName()
  210. {
  211. return "forms/fields/toggle/toggle.html.twig";
  212. }
  213. public function isTraitable()
  214. {
  215. return false;
  216. }
  217. public function getDebugInfo()
  218. {
  219. return array ( 205 => 20, 202 => 19, 189 => 18, 184 => 59, 174 => 57, 171 => 56, 166 => 55, 163 => 54, 159 => 52, 156 => 51, 153 => 50, 149 => 48, 147 => 47, 144 => 46, 141 => 45, 138 => 44, 133 => 43, 127 => 41, 125 => 40, 121 => 39, 117 => 38, 113 => 37, 109 => 35, 106 => 34, 103 => 33, 99 => 32, 96 => 31, 90 => 30, 87 => 29, 84 => 28, 79 => 27, 77 => 26, 69 => 25, 66 => 24, 63 => 23, 57 => 15, 52 => 14, 49 => 13, 45 => 1, 38 => 9, 36 => 8, 32 => 7, 30 => 6, 28 => 4, 26 => 3, 11 => 1,);
  220. }
  221. /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
  222. public function getSource()
  223. {
  224. @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
  225. return $this->getSourceContext()->getCode();
  226. }
  227. public function getSourceContext()
  228. {
  229. return new Twig_Source("{% extends \"forms/field.html.twig\" %}
  230. {% set value = (value is null ? field.default : value) %}
  231. {% set value = (value is same as(false) ? 0 : value) %}
  232. {% set has_hidden = false %}
  233. {% for key, text in field.options %}
  234. {% if key is empty %}
  235. {% set has_hidden = true %}
  236. {% endif %}
  237. {% endfor %}
  238. {% block global_attributes %}
  239. {{ parent() }}
  240. data-grav-field-name=\"{{ (scope ~ field.name)|fieldName }}\"
  241. {% endblock %}
  242. {% macro spanToggle(input, length) %}
  243. {% set space = repeat('&nbsp;&nbsp;', (length - input|length) / 2) %}
  244. {{ (space ~ input ~ space)|raw }}
  245. {% endmacro %}
  246. {% block input %}
  247. <div class=\"switch-toggle switch-grav {{ field.size }} switch-{{ field.options|length }} {{ field.classes }}\">
  248. {% set maxLen = 0 %}
  249. {% for text in field.options %}
  250. {% set translation = grav.twig.twig.filters['tu'] is defined ? text|tu : text|t %}
  251. {% set maxLen = max(translation|length, maxLen) %}
  252. {% endfor %}
  253. {% for key, text in field.options %}
  254. {% set id = \"toggle_\" ~ field.name ~ key %}
  255. {% set translation = (grav.twig.twig.filters['tu'] is defined ? text|tu : text|t)|trim %}
  256. <input type=\"radio\"
  257. value=\"{{ key }}\"
  258. id=\"{{ id }}\"
  259. name=\"{{ (scope ~ field.name)|fieldName }}\"
  260. {% if field.highlight is defined %}
  261. class=\"{{ field.highlight == '' ~ key ? 'highlight' : '' }}\"
  262. {% endif %}
  263. {% if field.disabled or isDisabledToggleable %}disabled=\"disabled\"{% endif %}
  264. {% if field.toggleable %}
  265. {% if '' ~ key == '' ~ value %}
  266. checked=\"checked\"
  267. {% elseif value is defined and (key == 1 or key == '1') %}
  268. checked=\"checked\"
  269. {% endif %}
  270. {% else %}
  271. {% if '' ~ key == '' ~ value %}
  272. checked=\"checked\"
  273. {% endif %}
  274. {% endif %}
  275. {% if field.validate.required in ['on', 'true', 1] %}required=\"required\"{% endif %}
  276. />
  277. <label for=\"{{ id }}\">{{ (_self.spanToggle(translation, maxLen)|trim)|raw }}</label>
  278. {% endfor %}
  279. </div>
  280. {% endblock %}
  281. ", "forms/fields/toggle/toggle.html.twig", "/mnt/data/Sites/static-ethica.net/user/plugins/admin/themes/grav/templates/forms/fields/toggle/toggle.html.twig");
  282. }
  283. }