8cf66c5d7224717fa1884b508745411ddd7ac9b48555cef28827012fa0b0eaa9.php 16 KB

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