var/cache/dev/twig/bd/bdaba1be6872f26bd745ab8844879eef.php line 35

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\SandboxExtension;
  6. use Twig\Markup;
  7. use Twig\Sandbox\SecurityError;
  8. use Twig\Sandbox\SecurityNotAllowedTagError;
  9. use Twig\Sandbox\SecurityNotAllowedFilterError;
  10. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  11. use Twig\Source;
  12. use Twig\Template;
  13. /* product/filters/multi_select_category.html.twig */
  14. class __TwigTemplate_096c7f28f96a666edffb664e5427e1a9 extends Template
  15. {
  16.     private $source;
  17.     private $macros = [];
  18.     public function __construct(Environment $env)
  19.     {
  20.         parent::__construct($env);
  21.         $this->source = $this->getSourceContext();
  22.         $this->parent = false;
  23.         $this->blocks = [
  24.         ];
  25.         $this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
  26.         $this->checkSecurity();
  27.     }
  28.     protected function doDisplay(array $context, array $blocks = [])
  29.     {
  30.         $macros = $this->macros;
  31.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  32.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "product/filters/multi_select_category.html.twig"));
  33.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  34.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "product/filters/multi_select_category.html.twig"));
  35.         // line 2
  36.         $context["usedResultCategories"] = twig_array_map($this->env, $this->sandbox->ensureToStringAllowed((isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 2, $this->source); })()), 2, $this->source), function ($__v__) use ($context, $macros) { $context["v"] = $__v__; return twig_get_attribute($this->env, $this->source, (isset($context["v"]) || array_key_exists("v", $context) ? $context["v"] : (function () { throw new RuntimeError('Variable "v" does not exist.', 2, $this->source); })()), "value", [], "any", false, false, true, 2); });
  37.         // line 3
  38.         echo "
  39. ";
  40.         // line 5
  41.         $context["rootCategory"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 5, $this->source); })()), "request", [], "any", false, false, true, 5), "get", ["category"], "method", false, false, true, 5)) ? (Pimcore\Model\DataObject::getById($this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 5, $this->source); })()), "request", [], "any", false, false, true, 5), "get", ["category"], "method", false, false, true, 5), 5, $this->source))) : (twig_get_attribute($this->env, $this->source, (isset($context["document"]) || array_key_exists("document", $context) ? $context["document"] : (function () { throw new RuntimeError('Variable "document" does not exist.', 5, $this->source); })()), "getProperty", ["products_root_category"], "method", false, false, true, 5)));
  42.         // line 6
  43.         $context["data"] = $this->extensions['App\Twig\Extension\CategoryFilterExtension']->prepareData($this->sandbox->ensureToStringAllowed((isset($context["currentValue"]) || array_key_exists("currentValue", $context) ? $context["currentValue"] : (function () { throw new RuntimeError('Variable "currentValue" does not exist.', 6, $this->source); })()), 6, $this->source), $this->sandbox->ensureToStringAllowed((isset($context["rootCategory"]) || array_key_exists("rootCategory", $context) ? $context["rootCategory"] : (function () { throw new RuntimeError('Variable "rootCategory" does not exist.', 6, $this->source); })()), 6, $this->source));
  44.         // line 7
  45.         echo "
  46. ";
  47.         // line 9
  48.         $context["activeCategories"] = twig_array_map($this->env, $this->sandbox->ensureToStringAllowed((isset($context["currentValue"]) || array_key_exists("currentValue", $context) ? $context["currentValue"] : (function () { throw new RuntimeError('Variable "currentValue" does not exist.', 9, $this->source); })()), 9, $this->source), function ($__c__) use ($context, $macros) { $context["c"] = $__c__; return (((twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "id", [], "any", true, true, true, 9) &&  !(null === twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "id", [], "any", false, false, true, 9)))) ? (twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "id", [], "any", false, false, true, 9)) : ((isset($context["c"]) || array_key_exists("c", $context) ? $context["c"] : (function () { throw new RuntimeError('Variable "c" does not exist.', 9, $this->source); })()))); });
  49.         // line 10
  50.         echo "
  51. <div class=\"filter\">
  52.     ";
  53.         // line 12
  54.         $context['_parent'] = $context;
  55.         $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, (isset($context["data"]) || array_key_exists("data", $context) ? $context["data"] : (function () { throw new RuntimeError('Variable "data" does not exist.', 12, $this->source); })()), "subCategories", [], "any", false, false, true, 12));
  56.         foreach ($context['_seq'] as $context["_key"] => $context["subCategory"]) {
  57.             // line 13
  58.             echo "        ";
  59.             if (twig_in_filter(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 13), (isset($context["usedResultCategories"]) || array_key_exists("usedResultCategories", $context) ? $context["usedResultCategories"] : (function () { throw new RuntimeError('Variable "usedResultCategories" does not exist.', 13, $this->source); })()))) {
  60.                 // line 14
  61.                 echo "            ";
  62.                 $context["checked"] = twig_in_filter(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 14), (isset($context["activeCategories"]) || array_key_exists("activeCategories", $context) ? $context["activeCategories"] : (function () { throw new RuntimeError('Variable "activeCategories" does not exist.', 14, $this->source); })()));
  63.                 // line 15
  64.                 echo "
  65.             <div class=\"form-check\">
  66.                 <input class=\"form-check-input\" type=\"checkbox\" value=\"";
  67.                 // line 17
  68.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 17), 17, $this->source), "html", null, true);
  69.                 echo "\" name=\"";
  70.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 17, $this->source); })()), 17, $this->source), "html", null, true);
  71.                 echo "[]\"
  72.                        id=\"";
  73.                 // line 18
  74.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 18, $this->source); })()), 18, $this->source), "html", null, true);
  75.                 echo "-";
  76.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 18), 18, $this->source), "html", null, true);
  77.                 echo "\" ";
  78.                 echo (((isset($context["checked"]) || array_key_exists("checked", $context) ? $context["checked"] : (function () { throw new RuntimeError('Variable "checked" does not exist.', 18, $this->source); })())) ? ("checked=\"checked\"") : (""));
  79.                 echo " disabled>
  80.                 <label class=\"form-check-label\"
  81.                        for=\"";
  82.                 // line 20
  83.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 20, $this->source); })()), 20, $this->source), "html", null, true);
  84.                 echo "-";
  85.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 20), 20, $this->source), "html", null, true);
  86.                 echo "\"> ";
  87.                 echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "name", [], "any", false, false, true, 20), 20, $this->source), "html", null, true);
  88.                 echo "</label>
  89.             </div>
  90.             ";
  91.                 // line 24
  92.                 echo "            ";
  93.                 $context["childCategories"] = twig_array_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "children", [], "any", false, false, true, 24), 24, $this->source), function ($__c__) use ($context, $macros) { $context["c"] = $__c__; return (twig_get_attribute($this->env, $this->source, (isset($context["c"]) || array_key_exists("c", $context) ? $context["c"] : (function () { throw new RuntimeError('Variable "c" does not exist.', 24, $this->source); })()), "published", [], "any", false, false, true, 24) && twig_in_filter(twig_get_attribute($this->env, $this->source, (isset($context["c"]) || array_key_exists("c", $context) ? $context["c"] : (function () { throw new RuntimeError('Variable "c" does not exist.', 24, $this->source); })()), "id", [], "any", false, false, true, 24), (isset($context["usedResultCategories"]) || array_key_exists("usedResultCategories", $context) ? $context["usedResultCategories"] : (function () { throw new RuntimeError('Variable "usedResultCategories" does not exist.', 24, $this->source); })()))); });
  94.                 // line 25
  95.                 echo "            ";
  96.                 if (twig_length_filter($this->env, (isset($context["childCategories"]) || array_key_exists("childCategories", $context) ? $context["childCategories"] : (function () { throw new RuntimeError('Variable "childCategories" does not exist.', 25, $this->source); })()))) {
  97.                     // line 26
  98.                     echo "                <div class=\"sidebar__sub\">
  99.                     ";
  100.                     // line 27
  101.                     $context['_parent'] = $context;
  102.                     $context['_seq'] = twig_ensure_traversable((isset($context["childCategories"]) || array_key_exists("childCategories", $context) ? $context["childCategories"] : (function () { throw new RuntimeError('Variable "childCategories" does not exist.', 27, $this->source); })()));
  103.                     foreach ($context['_seq'] as $context["_key"] => $context["childCategory"]) {
  104.                         // line 28
  105.                         echo "                        ";
  106.                         $context["checked"] = twig_in_filter(twig_get_attribute($this->env, $this->source, $context["childCategory"], "id", [], "any", false, false, true, 28), (isset($context["activeCategories"]) || array_key_exists("activeCategories", $context) ? $context["activeCategories"] : (function () { throw new RuntimeError('Variable "activeCategories" does not exist.', 28, $this->source); })()));
  107.                         // line 29
  108.                         echo "
  109.                         <div class=\"form-check\">
  110.                             <input class=\"form-check-input\" type=\"checkbox\" value=\"";
  111.                         // line 31
  112.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["childCategory"], "id", [], "any", false, false, true, 31), 31, $this->source), "html", null, true);
  113.                         echo "\"
  114.                                    name=\"";
  115.                         // line 32
  116.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 32, $this->source); })()), 32, $this->source), "html", null, true);
  117.                         echo "[]\" data-parent-id=\"";
  118.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["subCategory"], "id", [], "any", false, false, true, 32), 32, $this->source), "html", null, true);
  119.                         echo "\"
  120.                                    id=\"";
  121.                         // line 33
  122.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 33, $this->source); })()), 33, $this->source), "html", null, true);
  123.                         echo "-";
  124.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["childCategory"], "id", [], "any", false, false, true, 33), 33, $this->source), "html", null, true);
  125.                         echo "\" ";
  126.                         echo (((isset($context["checked"]) || array_key_exists("checked", $context) ? $context["checked"] : (function () { throw new RuntimeError('Variable "checked" does not exist.', 33, $this->source); })())) ? ("checked=\"checked\"") : (""));
  127.                         echo " disabled>
  128.                             <label class=\"form-check-label\"
  129.                                    for=\"";
  130.                         // line 35
  131.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["fieldname"]) || array_key_exists("fieldname", $context) ? $context["fieldname"] : (function () { throw new RuntimeError('Variable "fieldname" does not exist.', 35, $this->source); })()), 35, $this->source), "html", null, true);
  132.                         echo "-";
  133.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["childCategory"], "id", [], "any", false, false, true, 35), 35, $this->source), "html", null, true);
  134.                         echo "\"> ";
  135.                         echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["childCategory"], "name", [], "any", false, false, true, 35), 35, $this->source), "html", null, true);
  136.                         echo "</label>
  137.                         </div>
  138.                     ";
  139.                     }
  140.                     $_parent = $context['_parent'];
  141.                     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['childCategory'], $context['_parent'], $context['loop']);
  142.                     $context = array_intersect_key($context, $_parent) + $_parent;
  143.                     // line 38
  144.                     echo "                </div>
  145.             ";
  146.                 }
  147.                 // line 40
  148.                 echo "        ";
  149.             }
  150.             // line 41
  151.             echo "    ";
  152.         }
  153.         $_parent = $context['_parent'];
  154.         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['subCategory'], $context['_parent'], $context['loop']);
  155.         $context = array_intersect_key($context, $_parent) + $_parent;
  156.         // line 42
  157.         echo "</div>
  158. ";
  159.         
  160.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  161.         
  162.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  163.     }
  164.     public function getTemplateName()
  165.     {
  166.         return "product/filters/multi_select_category.html.twig";
  167.     }
  168.     public function isTraitable()
  169.     {
  170.         return false;
  171.     }
  172.     public function getDebugInfo()
  173.     {
  174.         return array (  167 => 42,  161 => 41,  158 => 40,  154 => 38,  141 => 35,  132 => 33,  126 => 32,  122 => 31,  118 => 29,  115 => 28,  111 => 27,  108 => 26,  105 => 25,  102 => 24,  92 => 20,  83 => 18,  77 => 17,  73 => 15,  70 => 14,  67 => 13,  63 => 12,  59 => 10,  57 => 9,  54 => 7,  52 => 6,  50 => 5,  47 => 3,  45 => 2,);
  175.     }
  176.     public function getSourceContext()
  177.     {
  178.         return new Source("{# Build used categories (search result) #}
  179. {% set usedResultCategories = values|map(v => v.value ) %}
  180. {# Build category tree #}
  181. {% set rootCategory = app.request.get('category') ? pimcore_object(app.request.get('category')) : document.getProperty('products_root_category') %}
  182. {% set data = app_category_filter_prepare_data(currentValue, rootCategory) %}
  183. {# Build checked categories #}
  184. {% set activeCategories = currentValue|map(c => c.id ?? c) %}
  185. <div class=\"filter\">
  186.     {% for subCategory in data.subCategories %}
  187.         {% if subCategory.id in usedResultCategories %}
  188.             {% set checked = subCategory.id in activeCategories %}
  189.             <div class=\"form-check\">
  190.                 <input class=\"form-check-input\" type=\"checkbox\" value=\"{{ subCategory.id }}\" name=\"{{ fieldname }}[]\"
  191.                        id=\"{{ fieldname }}-{{ subCategory.id }}\" {{ checked ? 'checked=\"checked\"' : '' }} disabled>
  192.                 <label class=\"form-check-label\"
  193.                        for=\"{{ fieldname }}-{{ subCategory.id }}\"> {{ subCategory.name }}</label>
  194.             </div>
  195.             {# Next level, shown indented under its parent #}
  196.             {% set childCategories = subCategory.children|filter(c => c.published and c.id in usedResultCategories) %}
  197.             {% if childCategories|length %}
  198.                 <div class=\"sidebar__sub\">
  199.                     {% for childCategory in childCategories %}
  200.                         {% set checked = childCategory.id in activeCategories %}
  201.                         <div class=\"form-check\">
  202.                             <input class=\"form-check-input\" type=\"checkbox\" value=\"{{ childCategory.id }}\"
  203.                                    name=\"{{ fieldname }}[]\" data-parent-id=\"{{ subCategory.id }}\"
  204.                                    id=\"{{ fieldname }}-{{ childCategory.id }}\" {{ checked ? 'checked=\"checked\"' : '' }} disabled>
  205.                             <label class=\"form-check-label\"
  206.                                    for=\"{{ fieldname }}-{{ childCategory.id }}\"> {{ childCategory.name }}</label>
  207.                         </div>
  208.                     {% endfor %}
  209.                 </div>
  210.             {% endif %}
  211.         {% endif %}
  212.     {% endfor %}
  213. </div>
  214. ", "product/filters/multi_select_category.html.twig", "/data/sites/web/devliegerfilipbe/subsites/dev.devliegerfilip.dspdev.be/templates/product/filters/multi_select_category.html.twig");
  215.     }
  216.     
  217.     public function checkSecurity()
  218.     {
  219.         static $tags = array("set" => 2, "for" => 12, "if" => 13);
  220.         static $filters = array("map" => 2, "escape" => 17, "filter" => 24, "length" => 25);
  221.         static $functions = array("pimcore_object" => 5, "app_category_filter_prepare_data" => 6);
  222.         try {
  223.             $this->sandbox->checkSecurity(
  224.                 ['set', 'for', 'if'],
  225.                 ['map', 'escape', 'filter', 'length'],
  226.                 ['pimcore_object', 'app_category_filter_prepare_data']
  227.             );
  228.         } catch (SecurityError $e) {
  229.             $e->setSourceContext($this->source);
  230.             if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
  231.                 $e->setTemplateLine($tags[$e->getTagName()]);
  232.             } elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
  233.                 $e->setTemplateLine($filters[$e->getFilterName()]);
  234.             } elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
  235.                 $e->setTemplateLine($functions[$e->getFunctionName()]);
  236.             }
  237.             throw $e;
  238.         }
  239.     }
  240. }