123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <?php
- /* forms/fields/toggle/toggle.html.twig */
- class __TwigTemplate_c1a99be3cdc53fcee4c61dc15d20e8c48c22c5e53af3058544ed9bc330d82f60 extends Twig_Template
- {
- public function __construct(Twig_Environment $env)
- {
- parent::__construct($env);
- // line 1
- $this->parent = $this->loadTemplate("forms/field.html.twig", "forms/fields/toggle/toggle.html.twig", 1);
- $this->blocks = array(
- 'global_attributes' => array($this, 'block_global_attributes'),
- 'input' => array($this, 'block_input'),
- );
- }
- protected function doGetParent(array $context)
- {
- return "forms/field.html.twig";
- }
- protected function doDisplay(array $context, array $blocks = array())
- {
- // line 3
- $context["value"] = (((null === ($context["value"] ?? null))) ? ($this->getAttribute(($context["field"] ?? null), "default", array())) : (($context["value"] ?? null)));
- // line 4
- $context["value"] = (((($context["value"] ?? null) === false)) ? (0) : (($context["value"] ?? null)));
- // line 6
- $context["has_hidden"] = false;
- // line 7
- $context['_parent'] = $context;
- $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
- foreach ($context['_seq'] as $context["key"] => $context["text"]) {
- // line 8
- if (twig_test_empty($context["key"])) {
- // line 9
- $context["has_hidden"] = true;
- }
- }
- $_parent = $context['_parent'];
- unset($context['_seq'], $context['_iterated'], $context['key'], $context['text'], $context['_parent'], $context['loop']);
- $context = array_intersect_key($context, $_parent) + $_parent;
- // line 1
- $this->parent->display($context, array_merge($this->blocks, $blocks));
- }
- // line 13
- public function block_global_attributes($context, array $blocks = array())
- {
- // line 14
- echo " ";
- $this->displayParentBlock("global_attributes", $context, $blocks);
- echo "
- data-grav-field-name=\"";
- // line 15
- 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);
- echo "\"
- ";
- }
- // line 23
- public function block_input($context, array $blocks = array())
- {
- // line 24
- echo "
- <div class=\"switch-toggle switch-grav ";
- // line 25
- echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "size", array()), "html", null, true);
- echo " switch-";
- echo twig_escape_filter($this->env, twig_length_filter($this->env, $this->getAttribute(($context["field"] ?? null), "options", array())), "html", null, true);
- echo " ";
- echo twig_escape_filter($this->env, $this->getAttribute(($context["field"] ?? null), "classes", array()), "html", null, true);
- echo "\">
- ";
- // line 26
- $context["maxLen"] = 0;
- // line 27
- echo " ";
- $context['_parent'] = $context;
- $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
- foreach ($context['_seq'] as $context["_key"] => $context["text"]) {
- // line 28
- echo " ";
- $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"])));
- // line 29
- echo " ";
- $context["maxLen"] = max(twig_length_filter($this->env, ($context["translation"] ?? null)), ($context["maxLen"] ?? null));
- // line 30
- echo " ";
- }
- $_parent = $context['_parent'];
- unset($context['_seq'], $context['_iterated'], $context['_key'], $context['text'], $context['_parent'], $context['loop']);
- $context = array_intersect_key($context, $_parent) + $_parent;
- // line 31
- echo "
- ";
- // line 32
- $context['_parent'] = $context;
- $context['_seq'] = twig_ensure_traversable($this->getAttribute(($context["field"] ?? null), "options", array()));
- foreach ($context['_seq'] as $context["key"] => $context["text"]) {
- // line 33
- echo " ";
- $context["id"] = (("toggle_" . $this->getAttribute(($context["field"] ?? null), "name", array())) . $context["key"]);
- // line 34
- echo " ";
- $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"]))));
- // line 35
- echo "
- <input type=\"radio\"
- value=\"";
- // line 37
- echo twig_escape_filter($this->env, $context["key"], "html", null, true);
- echo "\"
- id=\"";
- // line 38
- echo twig_escape_filter($this->env, ($context["id"] ?? null), "html", null, true);
- echo "\"
- name=\"";
- // line 39
- 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);
- echo "\"
- ";
- // line 40
- if ($this->getAttribute(($context["field"] ?? null), "highlight", array(), "any", true, true)) {
- // line 41
- echo " class=\"";
- echo ((($this->getAttribute(($context["field"] ?? null), "highlight", array()) == ("" . $context["key"]))) ? ("highlight") : (""));
- echo "\"
- ";
- }
- // line 43
- echo " ";
- if (($this->getAttribute(($context["field"] ?? null), "disabled", array()) || ($context["isDisabledToggleable"] ?? null))) {
- echo "disabled=\"disabled\"";
- }
- // line 44
- echo " ";
- if ($this->getAttribute(($context["field"] ?? null), "toggleable", array())) {
- // line 45
- echo " ";
- if ((("" . $context["key"]) == ("" . ($context["value"] ?? null)))) {
- // line 46
- echo " checked=\"checked\"
- ";
- } elseif (( // line 47
- array_key_exists("value", $context) && (($context["key"] == 1) || ($context["key"] == "1")))) {
- // line 48
- echo " checked=\"checked\"
- ";
- }
- // line 50
- echo " ";
- } else {
- // line 51
- echo " ";
- if ((("" . $context["key"]) == ("" . ($context["value"] ?? null)))) {
- // line 52
- echo " checked=\"checked\"
- ";
- }
- // line 54
- echo " ";
- }
- // line 55
- echo " ";
- if (twig_in_filter($this->getAttribute($this->getAttribute(($context["field"] ?? null), "validate", array()), "required", array()), array(0 => "on", 1 => "true", 2 => 1))) {
- echo "required=\"required\"";
- }
- // line 56
- echo " />
- <label for=\"";
- // line 57
- echo twig_escape_filter($this->env, ($context["id"] ?? null), "html", null, true);
- echo "\">";
- echo twig_trim_filter($this->getAttribute($this, "spanToggle", array(0 => ($context["translation"] ?? null), 1 => ($context["maxLen"] ?? null)), "method"));
- echo "</label>
- ";
- }
- $_parent = $context['_parent'];
- unset($context['_seq'], $context['_iterated'], $context['key'], $context['text'], $context['_parent'], $context['loop']);
- $context = array_intersect_key($context, $_parent) + $_parent;
- // line 59
- echo " </div>
- ";
- }
- // line 18
- public function getspanToggle($__input__ = null, $__length__ = null, ...$__varargs__)
- {
- $context = $this->env->mergeGlobals(array(
- "input" => $__input__,
- "length" => $__length__,
- "varargs" => $__varargs__,
- ));
- $blocks = array();
- ob_start();
- try {
- // line 19
- echo " ";
- $context["space"] = $this->env->getExtension('Grav\Common\Twig\TwigExtension')->repeatFunc(" ", ((($context["length"] ?? null) - twig_length_filter($this->env, ($context["input"] ?? null))) / 2));
- // line 20
- echo " ";
- echo ((($context["space"] ?? null) . ($context["input"] ?? null)) . ($context["space"] ?? null));
- echo "
- ";
- } catch (Exception $e) {
- ob_end_clean();
- throw $e;
- } catch (Throwable $e) {
- ob_end_clean();
- throw $e;
- }
- return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
- }
- public function getTemplateName()
- {
- return "forms/fields/toggle/toggle.html.twig";
- }
- public function isTraitable()
- {
- return false;
- }
- public function getDebugInfo()
- {
- 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,);
- }
- /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
- public function getSource()
- {
- @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);
- return $this->getSourceContext()->getCode();
- }
- public function getSourceContext()
- {
- return new Twig_Source("{% extends \"forms/field.html.twig\" %}
- {% set value = (value is null ? field.default : value) %}
- {% set value = (value is same as(false) ? 0 : value) %}
- {% set has_hidden = false %}
- {% for key, text in field.options %}
- {% if key is empty %}
- {% set has_hidden = true %}
- {% endif %}
- {% endfor %}
- {% block global_attributes %}
- {{ parent() }}
- data-grav-field-name=\"{{ (scope ~ field.name)|fieldName }}\"
- {% endblock %}
- {% macro spanToggle(input, length) %}
- {% set space = repeat(' ', (length - input|length) / 2) %}
- {{ (space ~ input ~ space)|raw }}
- {% endmacro %}
- {% block input %}
- <div class=\"switch-toggle switch-grav {{ field.size }} switch-{{ field.options|length }} {{ field.classes }}\">
- {% set maxLen = 0 %}
- {% for text in field.options %}
- {% set translation = grav.twig.twig.filters['tu'] is defined ? text|tu : text|t %}
- {% set maxLen = max(translation|length, maxLen) %}
- {% endfor %}
- {% for key, text in field.options %}
- {% set id = \"toggle_\" ~ field.name ~ key %}
- {% set translation = (grav.twig.twig.filters['tu'] is defined ? text|tu : text|t)|trim %}
- <input type=\"radio\"
- value=\"{{ key }}\"
- id=\"{{ id }}\"
- name=\"{{ (scope ~ field.name)|fieldName }}\"
- {% if field.highlight is defined %}
- class=\"{{ field.highlight == '' ~ key ? 'highlight' : '' }}\"
- {% endif %}
- {% if field.disabled or isDisabledToggleable %}disabled=\"disabled\"{% endif %}
- {% if field.toggleable %}
- {% if '' ~ key == '' ~ value %}
- checked=\"checked\"
- {% elseif value is defined and (key == 1 or key == '1') %}
- checked=\"checked\"
- {% endif %}
- {% else %}
- {% if '' ~ key == '' ~ value %}
- checked=\"checked\"
- {% endif %}
- {% endif %}
- {% if field.validate.required in ['on', 'true', 1] %}required=\"required\"{% endif %}
- />
- <label for=\"{{ id }}\">{{ (_self.spanToggle(translation, maxLen)|trim)|raw }}</label>
- {% endfor %}
- </div>
- {% endblock %}
- ", "forms/fields/toggle/toggle.html.twig", "/mnt/data/Sites/static-ethica.net/user/plugins/admin/themes/grav/templates/forms/fields/toggle/toggle.html.twig");
- }
- }
|