c9bab4cf49b561d0fe540dc52c2f29a93a3f4281e52a836fe230f7e401f0bb17.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /* forms/fields/pagemedia/pagemedia.html.twig */
  3. class __TwigTemplate_e212764c89a12fb166f2d9fc7ddc09b61a700cf74c309eabd9e54c716c52afa6 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. $context["value"] = (((null === ($context["value"] ?? null))) ? ($this->getAttribute(($context["field"] ?? null), "default", array())) : (($context["value"] ?? null)));
  16. // line 2
  17. $context["pagemedia"] = $this->getAttribute(($context["config"] ?? null), "get", array(0 => "plugins.admin.pagemedia"), "method");
  18. // line 3
  19. $context["pagemedia_settings"] = array("resolution" => array("min" => array("width" => (($this->getAttribute( // line 6
  20. ($context["pagemedia"] ?? null), "res_min_width", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "res_min_width", array())) : (null)), "height" => (($this->getAttribute( // line 7
  21. ($context["pagemedia"] ?? null), "res_min_height", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "res_min_height", array())) : (null))), "max" => array("width" => (($this->getAttribute( // line 10
  22. ($context["pagemedia"] ?? null), "res_max_width", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "res_max_width", array())) : (null)), "height" => (($this->getAttribute( // line 11
  23. ($context["pagemedia"] ?? null), "res_max_height", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "res_max_height", array())) : (null)))), "resizeWidth" => (($this->getAttribute( // line 14
  24. ($context["pagemedia"] ?? null), "resize_width", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "resize_width", array())) : (null)), "resizeHeight" => (($this->getAttribute( // line 15
  25. ($context["pagemedia"] ?? null), "resize_height", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "resize_height", array())) : (null)), "resizeQuality" => (($this->getAttribute( // line 16
  26. ($context["pagemedia"] ?? null), "resize_quality", array())) ? ($this->getAttribute(($context["pagemedia"] ?? null), "resize_quality", array())) : (0.8)));
  27. // line 18
  28. echo "
  29. ";
  30. // line 19
  31. if ($this->getAttribute(($context["context"] ?? null), "folderExists", array())) {
  32. // line 20
  33. echo "<div class=\"form-field grid vertical ";
  34. if ($this->getAttribute(($context["field"] ?? null), "classes", array(), "any", true, true)) {
  35. echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "classes", array()), "html", null, true);
  36. }
  37. echo "\">
  38. <div class=\"form-label\">
  39. <label>";
  40. // line 22
  41. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\Twig\AdminTwigExtension')->tuFilter($this->getAttribute(($context["field"] ?? null), "label", array())), "html", null, true);
  42. echo "</label>
  43. </div>
  44. <div class=\"form-data form-uploads-wrapper\">
  45. ";
  46. // line 25
  47. $context["uploadLimit"] = (($this->getAttribute($this->getAttribute($this->getAttribute($this->getAttribute(($context["grav"] ?? null), "config", array()), "system", array()), "media", array()), "upload_limit", array()) / 1024) / 1024);
  48. // line 26
  49. echo " ";
  50. $context["dropzoneSettings"] = twig_array_merge(array("maxFileSize" => ($context["uploadLimit"] ?? null)), ($context["pagemedia_settings"] ?? null));
  51. // line 27
  52. echo " <div id=\"grav-dropzone\"
  53. class=\"dropzone\"
  54. data-media-url=\"";
  55. // line 29
  56. echo twig_escape_filter($this->env, ($context["base_url"] ?? null), "html", null, true);
  57. echo "/media/";
  58. echo twig_escape_filter($this->env, twig_trim_filter($this->getAttribute(($context["admin"] ?? null), "route", array()), "/"), "html", null, true);
  59. echo ".json\"
  60. data-media-local=\"";
  61. // line 30
  62. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->rtrimFilter(($context["base_url_relative_frontend"] ?? null), "/"), "html", null, true);
  63. echo "/";
  64. echo twig_escape_filter($this->env, twig_trim_filter($this->getAttribute(($context["admin"] ?? null), "route", array()), "/"), "html", null, true);
  65. echo "\"
  66. data-media-path=\"";
  67. // line 31
  68. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Common\Twig\TwigExtension')->urlFunc($this->getAttribute(($context["context"] ?? null), "relativePagePath", array())), "html", null, true);
  69. echo "\"
  70. data-media-uri=\"";
  71. // line 32
  72. echo twig_escape_filter($this->env, $this->getAttribute(($context["context"] ?? null), "mediaUri", array()), "html", null, true);
  73. echo "\"
  74. data-dropzone-options=\"";
  75. // line 33
  76. echo twig_escape_filter($this->env, twig_jsonencode_filter(($context["dropzoneSettings"] ?? null)), "html_attr");
  77. echo "\"
  78. data-dropzone-field=\"";
  79. // line 34
  80. 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);
  81. echo "\"></div>
  82. ";
  83. // line 36
  84. if (($this->getAttribute($this->getAttribute(($context["admin"] ?? null), "session", array()), "expert", array()) == "0")) {
  85. // line 37
  86. echo " <input type=\"hidden\" name=\"";
  87. 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);
  88. echo "\" value=\"";
  89. echo twig_escape_filter($this->env, ($context["value"] ?? null));
  90. echo "\" />
  91. ";
  92. }
  93. // line 39
  94. echo " </div>
  95. </div>
  96. ";
  97. } else {
  98. // line 42
  99. echo "<div class=\"form-tab\">
  100. <div class=\"form-field\">
  101. <div class=\"form-label\">
  102. ";
  103. // line 45
  104. echo twig_escape_filter($this->env, $this->env->getExtension('Grav\Plugin\Admin\Twig\AdminTwigExtension')->tuFilter("PLUGIN_ADMIN.CANNOT_ADD_MEDIA_FILES_PAGE_NOT_SAVED"), "html", null, true);
  105. echo "
  106. </div>
  107. </div>
  108. </div>
  109. ";
  110. }
  111. }
  112. public function getTemplateName()
  113. {
  114. return "forms/fields/pagemedia/pagemedia.html.twig";
  115. }
  116. public function isTraitable()
  117. {
  118. return false;
  119. }
  120. public function getDebugInfo()
  121. {
  122. return array ( 109 => 45, 104 => 42, 99 => 39, 91 => 37, 89 => 36, 84 => 34, 80 => 33, 76 => 32, 72 => 31, 66 => 30, 60 => 29, 56 => 27, 53 => 26, 51 => 25, 45 => 22, 37 => 20, 35 => 19, 32 => 18, 30 => 16, 29 => 15, 28 => 14, 27 => 11, 26 => 10, 25 => 7, 24 => 6, 23 => 3, 21 => 2, 19 => 1,);
  123. }
  124. /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
  125. public function getSource()
  126. {
  127. @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
  128. return $this->getSourceContext()->getCode();
  129. }
  130. public function getSourceContext()
  131. {
  132. return new Twig_Source("{% set value = (value is null ? field.default : value) %}
  133. {% set pagemedia = config.get('plugins.admin.pagemedia') %}
  134. {% set pagemedia_settings = {
  135. resolution: {
  136. min: {
  137. width: pagemedia.res_min_width ?: null,
  138. height: pagemedia.res_min_height ?: null
  139. },
  140. max: {
  141. width: pagemedia.res_max_width ?: null,
  142. height: pagemedia.res_max_height ?: null
  143. }
  144. },
  145. resizeWidth: pagemedia.resize_width ?: null,
  146. resizeHeight: pagemedia.resize_height ?: null,
  147. resizeQuality: pagemedia.resize_quality ?: 0.8
  148. } %}
  149. {% if context.folderExists %}
  150. <div class=\"form-field grid vertical {% if field.classes is defined %}{{ field.classes }}{% endif %}\">
  151. <div class=\"form-label\">
  152. <label>{{ field.label|tu }}</label>
  153. </div>
  154. <div class=\"form-data form-uploads-wrapper\">
  155. {% set uploadLimit = grav.config.system.media.upload_limit / 1024 / 1024 %}
  156. {% set dropzoneSettings = { maxFileSize: uploadLimit }|merge(pagemedia_settings) %}
  157. <div id=\"grav-dropzone\"
  158. class=\"dropzone\"
  159. data-media-url=\"{{ base_url }}/media/{{ admin.route|trim('/') }}.json\"
  160. data-media-local=\"{{ base_url_relative_frontend|rtrim('/') }}/{{ admin.route|trim('/') }}\"
  161. data-media-path=\"{{ url(context.relativePagePath) }}\"
  162. data-media-uri=\"{{ context.mediaUri }}\"
  163. data-dropzone-options=\"{{ dropzoneSettings|json_encode|e('html_attr') }}\"
  164. data-dropzone-field=\"{{ (scope ~ field.name)|fieldName }}\"></div>
  165. {% if admin.session.expert == '0' %}
  166. <input type=\"hidden\" name=\"{{ (scope ~ field.name)|fieldName }}\" value=\"{{ value|e }}\" />
  167. {% endif %}
  168. </div>
  169. </div>
  170. {% else %}
  171. <div class=\"form-tab\">
  172. <div class=\"form-field\">
  173. <div class=\"form-label\">
  174. {{ \"PLUGIN_ADMIN.CANNOT_ADD_MEDIA_FILES_PAGE_NOT_SAVED\"|tu }}
  175. </div>
  176. </div>
  177. </div>
  178. {% endif %}
  179. ", "forms/fields/pagemedia/pagemedia.html.twig", "/mnt/data/Sites/r2c.net/user/plugins/admin/themes/grav/templates/forms/fields/pagemedia/pagemedia.html.twig");
  180. }
  181. }