44194b75ec8eacb0e0b74538a26b8821ea99e66a7b0bf01b43c526170a6e5a19.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <?php
  2. /* forms/fields/multilevel/multilevel.html.twig */
  3. class __TwigTemplate_16a5965171d27eb0b3e00aa2d77ebf230140c529290574416a955bd81e79159b 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/multilevel/multilevel.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-array-name=\"";
  28. 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);
  29. echo "\"
  30. data-grav-array-keyname=\"";
  31. // line 5
  32. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter(twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "placeholder_key", array()))), "html", null, true);
  33. echo "\"
  34. data-grav-array-valuename=\"";
  35. // line 6
  36. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter(twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "placeholder_value", array()))), "html", null, true);
  37. echo "\"
  38. ";
  39. // line 7
  40. $this->displayParentBlock("global_attributes", $context, $blocks);
  41. echo "
  42. ";
  43. }
  44. // line 89
  45. public function block_input($context, array $blocks = array())
  46. {
  47. // line 90
  48. echo " <div data-id=\"";
  49. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->randomStringFunc(), "html", null, true);
  50. echo "\" data-grav-multilevel-field data-grav-array-type=\"container\" data-grav-array-mode=\"value_only\"";
  51. echo (((twig_length_filter($this->env, ($context["value"] ?? null)) <= 1)) ? (" class=\"one-child\"") : (""));
  52. echo ">
  53. ";
  54. // line 91
  55. if (twig_length_filter($this->env, ($context["value"] ?? null))) {
  56. // line 92
  57. echo " ";
  58. $context['_parent'] = $context;
  59. $context['_seq'] = twig_ensure_traversable(($context["value"] ?? null));
  60. foreach ($context['_seq'] as $context["key"] => $context["content"]) {
  61. // line 93
  62. echo "<div class=\"element-wrapper\">
  63. ";
  64. // line 94
  65. echo $this->getAttribute($this, "renderer", array(0 => $context["key"], 1 => $context["content"], 2 => ($context["field"] ?? null), 3 => ($context["scope"] ?? null), 4 => 0, 5 => (("[" . $context["key"]) . "]"), 6 => true), "method");
  66. echo "
  67. </div>
  68. ";
  69. }
  70. $_parent = $context['_parent'];
  71. unset($context['_seq'], $context['_iterated'], $context['key'], $context['content'], $context['_parent'], $context['loop']);
  72. $context = array_intersect_key($context, $_parent) + $_parent;
  73. } else {
  74. // line 99
  75. echo " <div class=\"element-wrapper\">
  76. <div class=\"form-row array-field-value_only js__multilevel-field\"
  77. data-grav-array-type=\"row\">
  78. <input
  79. type=\"text\"
  80. name=\"";
  81. // line 105
  82. 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);
  83. echo "\"
  84. placeholder=\"Enter value\"
  85. value=\"\" />
  86. <span class=\"fa fa-minus js__remove-item\"></span>
  87. <span class=\"fa fa-plus js__add-sibling hidden\" data-level=\"0\" ></span>
  88. <span class=\"fa fa-plus-circle js__add-children hidden\" data-level=\"0\"></span>
  89. </div>
  90. </div>";
  91. }
  92. // line 115
  93. echo " </div>
  94. ";
  95. }
  96. // line 11
  97. public function getfield($__value__ = null, $__key__ = null, $__level__ = null, $__globalvars__ = null, $__disable_name__ = null, $__hidden__ = null, ...$__varargs__)
  98. {
  99. $context = $this->env->mergeGlobals(array(
  100. "value" => $__value__,
  101. "key" => $__key__,
  102. "level" => $__level__,
  103. "globalvars" => $__globalvars__,
  104. "disable_name" => $__disable_name__,
  105. "hidden" => $__hidden__,
  106. "varargs" => $__varargs__,
  107. ));
  108. $blocks = array();
  109. ob_start();
  110. try {
  111. // line 12
  112. echo " ";
  113. $context["name"] = ((("data[" . twig_replace_filter($this->getAttribute($this->getAttribute(($context["globalvars"] ?? null), "field", array()), "name", array()), array("." => "]["))) . "]") . ($context["key"] ?? null));
  114. // line 13
  115. echo " <div class=\"form-row array-field-value_only js__multilevel-field ";
  116. echo (((($context["level"] ?? null) == 0)) ? ("top") : (""));
  117. echo "\"
  118. data-grav-array-type=\"row\" ";
  119. // line 14
  120. if ((((array_key_exists("hidden", $context)) ? (_twig_default_filter(($context["hidden"] ?? null), false)) : (false)) == true)) {
  121. echo "style=\"display: none\"";
  122. }
  123. echo ">
  124. <input
  125. type=\"text\"
  126. ";
  127. // line 17
  128. if ((($context["disable_name"] ?? null) != true)) {
  129. echo "name=\"";
  130. echo twig_escape_filter($this->env, ($context["name"] ?? null), "html", null, true);
  131. echo "\"";
  132. }
  133. // line 18
  134. echo " data-attr-name=\"";
  135. echo twig_escape_filter($this->env, ($context["name"] ?? null), "html", null, true);
  136. echo "\"
  137. placeholder=\"";
  138. // line 19
  139. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\AdminTwigExtension')->tuFilter(twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "placeholder_value", array()))), "html", null, true);
  140. echo "\"
  141. style=\"margin-left: ";
  142. // line 20
  143. echo twig_escape_filter($this->env, (($context["level"] ?? null) * 50), "html", null, true);
  144. echo "px\"
  145. value=\"";
  146. // line 21
  147. echo twig_escape_filter($this->env, ($context["value"] ?? null), "html", null, true);
  148. echo "\" />
  149. <span class=\"fa fa-minus js__remove-item\"></span>
  150. <span class=\"fa fa-plus js__add-sibling hidden\" data-level=\"";
  151. // line 24
  152. echo twig_escape_filter($this->env, ($context["level"] ?? null), "html", null, true);
  153. echo "\"></span>
  154. <span class=\"fa fa-plus-circle js__add-children hidden\" data-level=\"";
  155. // line 25
  156. echo twig_escape_filter($this->env, ($context["level"] ?? null), "html", null, true);
  157. echo "\"></span>
  158. </div>
  159. ";
  160. } catch (Exception $e) {
  161. ob_end_clean();
  162. throw $e;
  163. } catch (Throwable $e) {
  164. ob_end_clean();
  165. throw $e;
  166. }
  167. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  168. }
  169. // line 10
  170. public function getrenderer($__key__ = null, $__content__ = null, $__field__ = null, $__scope__ = null, $__level__ = null, $__parent_key__ = null, $__up_level__ = null, ...$__varargs__)
  171. {
  172. $context = $this->env->mergeGlobals(array(
  173. "key" => $__key__,
  174. "content" => $__content__,
  175. "field" => $__field__,
  176. "scope" => $__scope__,
  177. "level" => $__level__,
  178. "parent_key" => $__parent_key__,
  179. "up_level" => $__up_level__,
  180. "varargs" => $__varargs__,
  181. ));
  182. $blocks = array();
  183. ob_start();
  184. try {
  185. // line 11
  186. echo " ";
  187. // line 28
  188. echo "
  189. ";
  190. // line 29
  191. if ((($context["level"] ?? null) == 0)) {
  192. // line 30
  193. echo "
  194. ";
  195. // line 31
  196. echo $this->getAttribute($this, "field", array(0 => ($context["key"] ?? null), 1 => "", 2 => ($context["level"] ?? null), 3 => $context, 4 => true, 5 => ((is_numeric(($context["key"] ?? null))) ? (true) : (false))), "method");
  197. echo "
  198. ";
  199. // line 33
  200. if ( !twig_test_iterable(($context["content"] ?? null))) {
  201. // line 34
  202. echo " ";
  203. $context["level2"] = (($context["level"] ?? null) + 1);
  204. // line 35
  205. echo "
  206. <div class=\"children-wrapper\">
  207. <div class=\"element-wrapper\">
  208. ";
  209. // line 38
  210. echo $this->getAttribute($this, "field", array(0 => ($context["content"] ?? null), 1 => (("[" . ($context["key"] ?? null)) . "]"), 2 => ($context["level2"] ?? null), 3 => $context), "method");
  211. echo "
  212. </div>
  213. </div>
  214. ";
  215. }
  216. // line 42
  217. echo " ";
  218. }
  219. // line 43
  220. echo "
  221. ";
  222. // line 44
  223. if (($context["up_level"] ?? null)) {
  224. // line 45
  225. echo " ";
  226. $context["level"] = (($context["level"] ?? null) + 1);
  227. // line 46
  228. echo " ";
  229. }
  230. // line 47
  231. echo " <div class=\"children-wrapper\">
  232. ";
  233. // line 48
  234. $context["unique_child"] = (((is_array(($context["content"] ?? null)) && ($this->getAttribute(($context["content"] ?? null), "length", array()) > 1))) ? (true) : (false));
  235. // line 49
  236. echo "
  237. ";
  238. // line 50
  239. $context['_parent'] = $context;
  240. $context['_seq'] = twig_ensure_traversable(($context["content"] ?? null));
  241. foreach ($context['_seq'] as $context["inner_key"] => $context["inner_content"]) {
  242. // line 51
  243. echo "<div class=\"element-wrapper\">
  244. ";
  245. // line 52
  246. if ( !is_numeric($context["inner_key"])) {
  247. // line 53
  248. echo " ";
  249. if ((twig_length_filter($this->env, ($context["content"] ?? null)) > 1)) {
  250. // line 54
  251. echo " ";
  252. echo $this->getAttribute($this, "field", array(0 => $context["inner_key"], 1 => ($context["parent_key"] ?? null), 2 => ($context["level"] ?? null), 3 => $context, 4 => true), "method");
  253. echo "
  254. ";
  255. } else {
  256. // line 56
  257. echo " ";
  258. echo $this->getAttribute($this, "field", array(0 => $context["inner_key"], 1 => ($context["parent_key"] ?? null), 2 => ($context["level"] ?? null), 3 => $context), "method");
  259. echo "
  260. ";
  261. }
  262. // line 58
  263. echo " ";
  264. $context["level2"] = (($context["level"] ?? null) + 1);
  265. // line 59
  266. echo " ";
  267. $context["up_level"] = true;
  268. // line 60
  269. echo " ";
  270. } else {
  271. // line 61
  272. echo " ";
  273. $context["up_level"] = false;
  274. // line 62
  275. echo " ";
  276. $context["level2"] = ($context["level"] ?? null);
  277. // line 63
  278. echo " ";
  279. }
  280. // line 64
  281. echo "
  282. ";
  283. // line 65
  284. if ( !twig_test_iterable($context["inner_content"])) {
  285. // line 66
  286. echo "
  287. ";
  288. // line 67
  289. if ( !is_numeric($context["inner_key"])) {
  290. // line 68
  291. echo " <div class=\"children-wrapper\">
  292. <div class=\"element-wrapper\">
  293. ";
  294. }
  295. // line 71
  296. echo "
  297. ";
  298. // line 72
  299. $context["last_key"] = ((is_numeric($context["inner_key"])) ? ("") : ($context["inner_key"]));
  300. // line 73
  301. echo " ";
  302. echo $this->getAttribute($this, "field", array(0 => $context["inner_content"], 1 => (((($context["parent_key"] ?? null) . "[") . $context["inner_key"]) . "]"), 2 => ($context["level2"] ?? null), 3 => $context), "method");
  303. echo "
  304. ";
  305. // line 75
  306. if ( !is_numeric($context["inner_key"])) {
  307. // line 76
  308. echo " </div>
  309. </div>
  310. ";
  311. }
  312. // line 79
  313. echo " ";
  314. } else {
  315. // line 80
  316. echo "
  317. ";
  318. // line 81
  319. $context["inner_parent_key"] = (((($context["parent_key"] ?? null) . "[") . $context["inner_key"]) . "]");
  320. // line 82
  321. echo " ";
  322. echo $this->getAttribute($this, "renderer", array(0 => $context["inner_key"], 1 => $context["inner_content"], 2 => ($context["field"] ?? null), 3 => ($context["scope"] ?? null), 4 => ($context["level"] ?? null), 5 => ($context["inner_parent_key"] ?? null), 6 => ($context["up_level"] ?? null)), "method");
  323. echo "
  324. ";
  325. }
  326. // line 84
  327. echo " </div>
  328. ";
  329. }
  330. $_parent = $context['_parent'];
  331. unset($context['_seq'], $context['_iterated'], $context['inner_key'], $context['inner_content'], $context['_parent'], $context['loop']);
  332. $context = array_intersect_key($context, $_parent) + $_parent;
  333. // line 86
  334. echo " </div>
  335. ";
  336. } catch (Exception $e) {
  337. ob_end_clean();
  338. throw $e;
  339. } catch (Throwable $e) {
  340. ob_end_clean();
  341. throw $e;
  342. }
  343. return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
  344. }
  345. public function getTemplateName()
  346. {
  347. return "forms/fields/multilevel/multilevel.html.twig";
  348. }
  349. public function isTraitable()
  350. {
  351. return false;
  352. }
  353. public function getDebugInfo()
  354. {
  355. return array ( 354 => 86, 347 => 84, 341 => 82, 339 => 81, 336 => 80, 333 => 79, 328 => 76, 326 => 75, 320 => 73, 318 => 72, 315 => 71, 310 => 68, 308 => 67, 305 => 66, 303 => 65, 300 => 64, 297 => 63, 294 => 62, 291 => 61, 288 => 60, 285 => 59, 282 => 58, 276 => 56, 270 => 54, 267 => 53, 265 => 52, 262 => 51, 258 => 50, 255 => 49, 253 => 48, 250 => 47, 247 => 46, 244 => 45, 242 => 44, 239 => 43, 236 => 42, 229 => 38, 224 => 35, 221 => 34, 219 => 33, 214 => 31, 211 => 30, 209 => 29, 206 => 28, 204 => 11, 186 => 10, 168 => 25, 164 => 24, 158 => 21, 154 => 20, 150 => 19, 145 => 18, 139 => 17, 131 => 14, 126 => 13, 123 => 12, 106 => 11, 101 => 115, 89 => 105, 81 => 99, 71 => 94, 68 => 93, 63 => 92, 61 => 91, 54 => 90, 51 => 89, 45 => 7, 41 => 6, 37 => 5, 32 => 4, 29 => 3, 11 => 1,);
  356. }
  357. /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
  358. public function getSource()
  359. {
  360. @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
  361. return $this->getSourceContext()->getCode();
  362. }
  363. public function getSourceContext()
  364. {
  365. return new Twig_Source("{% extends \"forms/field.html.twig\" %}
  366. {% block global_attributes %}
  367. data-grav-array-name=\"{{ (scope ~ field.name)|fieldName }}\"
  368. data-grav-array-keyname=\"{{ field.placeholder_key|e|tu }}\"
  369. data-grav-array-valuename=\"{{ field.placeholder_value|e|tu }}\"
  370. {{ parent() }}
  371. {% endblock %}
  372. {% macro renderer(key, content, field, scope, level, parent_key, up_level) %}
  373. {% macro field(value, key, level, globalvars, disable_name, hidden) %}
  374. {% set name = 'data[' ~ globalvars.field.name|replace({'.': ']['}) ~ ']' ~ key %}
  375. <div class=\"form-row array-field-value_only js__multilevel-field {{ level == 0 ? 'top' : '' }}\"
  376. data-grav-array-type=\"row\" {% if (hidden|default(false) == true) %}style=\"display: none\"{% endif %}>
  377. <input
  378. type=\"text\"
  379. {% if (disable_name != true) %}name=\"{{ name }}\"{% endif %}
  380. data-attr-name=\"{{ name }}\"
  381. placeholder=\"{{ field.placeholder_value|e|tu }}\"
  382. style=\"margin-left: {{ level * 50 }}px\"
  383. value=\"{{ value }}\" />
  384. <span class=\"fa fa-minus js__remove-item\"></span>
  385. <span class=\"fa fa-plus js__add-sibling hidden\" data-level=\"{{level}}\"></span>
  386. <span class=\"fa fa-plus-circle js__add-children hidden\" data-level=\"{{level}}\"></span>
  387. </div>
  388. {% endmacro %}
  389. {% if level == 0 %}
  390. {{ _self.field(key, '', level, _context, true, (is_numeric(key) ? true : false)) }}
  391. {% if content is not iterable %}
  392. {% set level2 = level + 1 %}
  393. <div class=\"children-wrapper\">
  394. <div class=\"element-wrapper\">
  395. {{ _self.field(content, '[' ~ key ~ ']', level2, _context) }}
  396. </div>
  397. </div>
  398. {% endif %}
  399. {% endif %}
  400. {% if up_level %}
  401. {% set level = level + 1 %}
  402. {% endif %}
  403. <div class=\"children-wrapper\">
  404. {% set unique_child = (is_array(content) and content.length > 1) ? true : false %}
  405. {% for inner_key, inner_content in content -%}
  406. <div class=\"element-wrapper\">
  407. {% if not is_numeric(inner_key) %}
  408. {% if (content|length > 1) %}
  409. {{ _self.field(inner_key, parent_key, level, _context, true) }}
  410. {% else %}
  411. {{ _self.field(inner_key, parent_key, level, _context) }}
  412. {% endif %}
  413. {% set level2 = level + 1 %}
  414. {% set up_level = true %}
  415. {% else %}
  416. {% set up_level = false %}
  417. {% set level2 = level %}
  418. {% endif %}
  419. {% if inner_content is not iterable %}
  420. {% if not is_numeric(inner_key) %}
  421. <div class=\"children-wrapper\">
  422. <div class=\"element-wrapper\">
  423. {% endif %}
  424. {% set last_key = (is_numeric(inner_key)) ? '' : inner_key %}
  425. {{ _self.field(inner_content, parent_key ~ '[' ~ inner_key ~ ']', level2, _context) }}
  426. {% if not is_numeric(inner_key) %}
  427. </div>
  428. </div>
  429. {% endif %}
  430. {% else %}
  431. {% set inner_parent_key = parent_key ~ '[' ~ inner_key ~ ']' %}
  432. {{ _self.renderer(inner_key, inner_content, field, scope, level, inner_parent_key, up_level) }}
  433. {% endif %}
  434. </div>
  435. {% endfor %}
  436. </div>
  437. {% endmacro %}
  438. {% block input %}
  439. <div data-id=\"{{random_string()}}\" data-grav-multilevel-field data-grav-array-type=\"container\" data-grav-array-mode=\"value_only\"{{ value|length <= 1 ? ' class=\"one-child\"' : '' }}>
  440. {% if value|length %}
  441. {% for key, content in value -%}
  442. <div class=\"element-wrapper\">
  443. {{ _self.renderer(key, content, field, scope, 0, '[' ~ key ~ ']', true) }}
  444. </div>
  445. {% endfor %}
  446. {%- else -%}
  447. {# Empty value, mock the entry field#}
  448. <div class=\"element-wrapper\">
  449. <div class=\"form-row array-field-value_only js__multilevel-field\"
  450. data-grav-array-type=\"row\">
  451. <input
  452. type=\"text\"
  453. name=\"{{ (scope ~ field.name)|fieldName }}\"
  454. placeholder=\"Enter value\"
  455. value=\"\" />
  456. <span class=\"fa fa-minus js__remove-item\"></span>
  457. <span class=\"fa fa-plus js__add-sibling hidden\" data-level=\"0\" ></span>
  458. <span class=\"fa fa-plus-circle js__add-children hidden\" data-level=\"0\"></span>
  459. </div>
  460. </div>
  461. {%- endif %}
  462. </div>
  463. {% endblock %}
  464. ", "forms/fields/multilevel/multilevel.html.twig", "/mnt/data/Sites/static-ethica.net/user/plugins/admin/themes/grav/templates/forms/fields/multilevel/multilevel.html.twig");
  465. }
  466. }