7d6489d000cdf92ca8caf73155304553df3e8dea2db3430b8f424d2fef0804f3.php 16 KB

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