<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* product/filters/multi_select_category.html.twig */
class __TwigTemplate_096c7f28f96a666edffb664e5427e1a9 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
$this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
$this->checkSecurity();
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "product/filters/multi_select_category.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "product/filters/multi_select_category.html.twig"));
// line 2
$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); });
// line 3
echo "
";
// line 5
$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)));
// line 6
$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));
// line 7
echo "
";
// line 9
$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); })()))); });
// line 10
echo "
<div class=\"filter\">
";
// line 12
$context['_parent'] = $context;
$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));
foreach ($context['_seq'] as $context["_key"] => $context["subCategory"]) {
// line 13
echo " ";
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); })()))) {
// line 14
echo " ";
$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); })()));
// line 15
echo "
<div class=\"form-check\">
<input class=\"form-check-input\" type=\"checkbox\" value=\"";
// line 17
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);
echo "\" name=\"";
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);
echo "[]\"
id=\"";
// line 18
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);
echo "-";
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);
echo "\" ";
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\"") : (""));
echo " disabled>
<label class=\"form-check-label\"
for=\"";
// line 20
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);
echo "-";
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);
echo "\"> ";
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);
echo "</label>
</div>
";
// line 24
echo " ";
$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); })()))); });
// line 25
echo " ";
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); })()))) {
// line 26
echo " <div class=\"sidebar__sub\">
";
// line 27
$context['_parent'] = $context;
$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); })()));
foreach ($context['_seq'] as $context["_key"] => $context["childCategory"]) {
// line 28
echo " ";
$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); })()));
// line 29
echo "
<div class=\"form-check\">
<input class=\"form-check-input\" type=\"checkbox\" value=\"";
// line 31
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);
echo "\"
name=\"";
// line 32
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);
echo "[]\" data-parent-id=\"";
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);
echo "\"
id=\"";
// line 33
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);
echo "-";
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);
echo "\" ";
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\"") : (""));
echo " disabled>
<label class=\"form-check-label\"
for=\"";
// line 35
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);
echo "-";
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);
echo "\"> ";
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);
echo "</label>
</div>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['childCategory'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 38
echo " </div>
";
}
// line 40
echo " ";
}
// line 41
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['subCategory'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 42
echo "</div>
";
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
public function getTemplateName()
{
return "product/filters/multi_select_category.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
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,);
}
public function getSourceContext()
{
return new Source("{# Build used categories (search result) #}
{% set usedResultCategories = values|map(v => v.value ) %}
{# Build category tree #}
{% set rootCategory = app.request.get('category') ? pimcore_object(app.request.get('category')) : document.getProperty('products_root_category') %}
{% set data = app_category_filter_prepare_data(currentValue, rootCategory) %}
{# Build checked categories #}
{% set activeCategories = currentValue|map(c => c.id ?? c) %}
<div class=\"filter\">
{% for subCategory in data.subCategories %}
{% if subCategory.id in usedResultCategories %}
{% set checked = subCategory.id in activeCategories %}
<div class=\"form-check\">
<input class=\"form-check-input\" type=\"checkbox\" value=\"{{ subCategory.id }}\" name=\"{{ fieldname }}[]\"
id=\"{{ fieldname }}-{{ subCategory.id }}\" {{ checked ? 'checked=\"checked\"' : '' }} disabled>
<label class=\"form-check-label\"
for=\"{{ fieldname }}-{{ subCategory.id }}\"> {{ subCategory.name }}</label>
</div>
{# Next level, shown indented under its parent #}
{% set childCategories = subCategory.children|filter(c => c.published and c.id in usedResultCategories) %}
{% if childCategories|length %}
<div class=\"sidebar__sub\">
{% for childCategory in childCategories %}
{% set checked = childCategory.id in activeCategories %}
<div class=\"form-check\">
<input class=\"form-check-input\" type=\"checkbox\" value=\"{{ childCategory.id }}\"
name=\"{{ fieldname }}[]\" data-parent-id=\"{{ subCategory.id }}\"
id=\"{{ fieldname }}-{{ childCategory.id }}\" {{ checked ? 'checked=\"checked\"' : '' }} disabled>
<label class=\"form-check-label\"
for=\"{{ fieldname }}-{{ childCategory.id }}\"> {{ childCategory.name }}</label>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>
", "product/filters/multi_select_category.html.twig", "/data/sites/web/devliegerfilipbe/subsites/dev.devliegerfilip.dspdev.be/templates/product/filters/multi_select_category.html.twig");
}
public function checkSecurity()
{
static $tags = array("set" => 2, "for" => 12, "if" => 13);
static $filters = array("map" => 2, "escape" => 17, "filter" => 24, "length" => 25);
static $functions = array("pimcore_object" => 5, "app_category_filter_prepare_data" => 6);
try {
$this->sandbox->checkSecurity(
['set', 'for', 'if'],
['map', 'escape', 'filter', 'length'],
['pimcore_object', 'app_category_filter_prepare_data']
);
} catch (SecurityError $e) {
$e->setSourceContext($this->source);
if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
}
}