<?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;
/* blocks/B51_search_results/B51_search_results.default.html.twig */
class __TwigTemplate_6dc0b81aee789b5361fa3c832e88b64d extends \Twig\Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
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", "blocks/B51_search_results/B51_search_results.default.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "blocks/B51_search_results/B51_search_results.default.html.twig"));
// line 1
if ((isset($context["hasGeneralSearch"]) || array_key_exists("hasGeneralSearch", $context) ? $context["hasGeneralSearch"] : (function () { throw new RuntimeError('Variable "hasGeneralSearch" does not exist.', 1, $this->source); })())) {
// line 2
echo " ";
$macros["macros"] = $this->macros["macros"] = $this->loadTemplate("blocks\\macros.html.twig", "blocks/B51_search_results/B51_search_results.default.html.twig", 2)->unwrap();
// line 3
echo " <section class=\"block-search-results\" ";
echo twig_call_macro($macros["macros"], "macro_getBlockDataAttributes", [$context], 3, $context, $this->getSourceContext());
echo ">
<div class=\"container\">
";
// line 5
if ((twig_length_filter($this->env, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 5, $this->source); })())) == 0)) {
// line 6
echo " ";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("zerorecords", [], "studio"), "html", null, true);
echo "
";
} else {
// line 8
echo " ";
// line 9
echo " ";
// line 10
echo " ";
// line 11
echo " ";
$context["resultsMeta"] = ((array_key_exists("results", $context)) ? ((isset($context["results"]) || array_key_exists("results", $context) ? $context["results"] : (function () { throw new RuntimeError('Variable "results" does not exist.', 11, $this->source); })())) : (["items" => ((twig_get_attribute($this->env, $this->source, // line 12
($context["values"] ?? null), "items", [], "any", true, true, false, 12)) ? (twig_get_attribute($this->env, $this->source, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 12, $this->source); })()), "items", [], "any", false, false, false, 12)) : ((isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 12, $this->source); })()))), "counts" => ["news" => 0, "news_reports" => 0, "programs" => 0, "event" => 0, "all" => 0], "currentType" => ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 14
($context["app"] ?? null), "request", [], "any", false, true, false, 14), "query", [], "any", false, true, false, 14), "get", [0 => "type"], "method", true, true, false, 14)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", [], "any", false, true, false, 14), "query", [], "any", false, true, false, 14), "get", [0 => "type"], "method", false, false, false, 14), "all")) : ("all")), "order" => ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 15
($context["app"] ?? null), "request", [], "any", false, true, false, 15), "query", [], "any", false, true, false, 15), "get", [0 => "order"], "method", true, true, false, 15)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", [], "any", false, true, false, 15), "query", [], "any", false, true, false, 15), "get", [0 => "order"], "method", false, false, false, 15), "relevance")) : ("relevance")), "page" => (((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 16
($context["app"] ?? null), "request", [], "any", false, true, false, 16), "query", [], "any", false, true, false, 16), "get", [0 => "page"], "method", true, true, false, 16)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", [], "any", false, true, false, 16), "query", [], "any", false, true, false, 16), "get", [0 => "page"], "method", false, false, false, 16), 1)) : (1)) + 0), "pageSize" => 15, "pageCount" => 1, "nextPage" => 0, "total" => ((twig_get_attribute($this->env, $this->source, // line 20
($context["values"] ?? null), "items", [], "any", true, true, false, 20)) ? (twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 20, $this->source); })()), "items", [], "any", false, false, false, 20))) : (twig_length_filter($this->env, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 20, $this->source); })())))), "totalAll" => ((twig_get_attribute($this->env, $this->source, // line 21
($context["values"] ?? null), "items", [], "any", true, true, false, 21)) ? (twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 21, $this->source); })()), "items", [], "any", false, false, false, 21))) : (twig_length_filter($this->env, (isset($context["values"]) || array_key_exists("values", $context) ? $context["values"] : (function () { throw new RuntimeError('Variable "values" does not exist.', 21, $this->source); })()))))]));
// line 23
echo " ";
$context["items"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 23, $this->source); })()), "items", [], "any", false, false, false, 23);
// line 24
echo " ";
$context["counts"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 24, $this->source); })()), "counts", [], "any", false, false, false, 24);
// line 25
echo " ";
$context["currentType"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 25, $this->source); })()), "currentType", [], "any", false, false, false, 25);
// line 26
echo " ";
$context["order"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 26, $this->source); })()), "order", [], "any", false, false, false, 26);
// line 27
echo " ";
$context["route"] = twig_get_attribute($this->env, $this->source, 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.', 27, $this->source); })()), "request", [], "any", false, false, false, 27), "attributes", [], "any", false, false, false, 27), "get", [0 => "_route"], "method", false, false, false, 27);
// line 28
echo " ";
$context["routeParams"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", [], "any", false, true, false, 28), "attributes", [], "any", false, true, false, 28), "get", [0 => "_route_params"], "method", true, true, false, 28)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["app"] ?? null), "request", [], "any", false, true, false, 28), "attributes", [], "any", false, true, false, 28), "get", [0 => "_route_params"], "method", false, false, false, 28), [])) : ([]));
// line 29
echo " ";
$context["currentPage"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 29, $this->source); })()), "page", [], "any", false, false, false, 29);
// line 30
echo " ";
$context["pageSize"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 30, $this->source); })()), "pageSize", [], "any", false, false, false, 30);
// line 31
echo " ";
$context["pageCount"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 31, $this->source); })()), "pageCount", [], "any", false, false, false, 31);
// line 32
echo " ";
$context["nextPage"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 32, $this->source); })()), "nextPage", [], "any", false, false, false, 32);
// line 33
echo " ";
$context["totalItems"] = twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 33, $this->source); })()), "total", [], "any", false, false, false, 33);
// line 34
echo " ";
$context["pageItems"] = (isset($context["items"]) || array_key_exists("items", $context) ? $context["items"] : (function () { throw new RuntimeError('Variable "items" does not exist.', 34, $this->source); })());
// line 35
echo "
";
// line 37
echo " ";
// line 38
echo "
";
// line 40
echo " ";
// line 41
echo " ";
// line 42
echo "
";
// line 43
if (twig_get_attribute($this->env, $this->source, 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.', 43, $this->source); })()), "request", [], "any", false, false, false, 43), "query", [], "any", false, false, false, 43), "get", [0 => "p"], "method", false, false, false, 43)) {
// line 44
echo " ";
$context["resultString"] = (("<h1 class=\"results-title\">Conta lá <span>" . twig_get_attribute($this->env, $this->source, 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.', 44, $this->source); })()), "request", [], "any", false, false, false, 44), "query", [], "any", false, false, false, 44), "get", [0 => "p"], "method", false, false, false, 44)) . "</span></h1>");
// line 45
echo " ";
} elseif (twig_get_attribute($this->env, $this->source, 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.', 45, $this->source); })()), "request", [], "any", false, false, false, 45), "query", [], "any", false, false, false, 45), "get", [0 => "themes"], "method", false, false, false, 45)) {
// line 46
echo " ";
$context["themes"] = twig_get_attribute($this->env, $this->source, 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.', 46, $this->source); })()), "request", [], "any", false, false, false, 46), "query", [], "any", false, false, false, 46), "get", [0 => "themes"], "method", false, false, false, 46);
// line 47
echo " ";
$context["resultString"] = (("<h1 class=\"results-title\">Conta lá <span>" . (((twig_length_filter($this->env, (isset($context["themes"]) || array_key_exists("themes", $context) ? $context["themes"] : (function () { throw new RuntimeError('Variable "themes" does not exist.', 47, $this->source); })())) == 1)) ? (twig_get_attribute($this->env, $this->source, (isset($context["themes"]) || array_key_exists("themes", $context) ? $context["themes"] : (function () { throw new RuntimeError('Variable "themes" does not exist.', 47, $this->source); })()), 0, [], "array", false, false, false, 47)) : (twig_join_filter((isset($context["themes"]) || array_key_exists("themes", $context) ? $context["themes"] : (function () { throw new RuntimeError('Variable "themes" does not exist.', 47, $this->source); })()), ", ")))) . "</span></h1>");
// line 48
echo " ";
}
// line 49
echo "
";
// line 50
echo ((array_key_exists("resultString", $context)) ? (_twig_default_filter((isset($context["resultString"]) || array_key_exists("resultString", $context) ? $context["resultString"] : (function () { throw new RuntimeError('Variable "resultString" does not exist.', 50, $this->source); })()))) : (""));
echo "
<div class=\"results-bar mb-4\" data-current-page=\"";
// line 52
echo twig_escape_filter($this->env, (isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 52, $this->source); })()), "html", null, true);
echo "\" data-page-count=\"";
echo twig_escape_filter($this->env, (isset($context["pageCount"]) || array_key_exists("pageCount", $context) ? $context["pageCount"] : (function () { throw new RuntimeError('Variable "pageCount" does not exist.', 52, $this->source); })()), "html", null, true);
echo "\"
data-page-size=\"";
// line 53
echo twig_escape_filter($this->env, (isset($context["pageSize"]) || array_key_exists("pageSize", $context) ? $context["pageSize"] : (function () { throw new RuntimeError('Variable "pageSize" does not exist.', 53, $this->source); })()), "html", null, true);
echo "\"
data-total-all=\"";
// line 54
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["resultsMeta"] ?? null), "totalAll", [], "any", true, true, false, 54)) ? (twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 54, $this->source); })()), "totalAll", [], "any", false, false, false, 54)) : (((array_key_exists("total", $context)) ? ((isset($context["total"]) || array_key_exists("total", $context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.', 54, $this->source); })())) : ((isset($context["totalItems"]) || array_key_exists("totalItems", $context) ? $context["totalItems"] : (function () { throw new RuntimeError('Variable "totalItems" does not exist.', 54, $this->source); })()))))), "html", null, true);
echo "\">
<div class=\"results-bar-top d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3\">
<div class=\"results-stats\">
<span class=\"results-found-prefix\">Encontrados</span>
<span class=\"results-total\">";
// line 58
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["resultsMeta"] ?? null), "totalAll", [], "any", true, true, false, 58)) ? (twig_get_attribute($this->env, $this->source, (isset($context["resultsMeta"]) || array_key_exists("resultsMeta", $context) ? $context["resultsMeta"] : (function () { throw new RuntimeError('Variable "resultsMeta" does not exist.', 58, $this->source); })()), "totalAll", [], "any", false, false, false, 58)) : (((array_key_exists("total", $context)) ? ((isset($context["total"]) || array_key_exists("total", $context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.', 58, $this->source); })())) : ((isset($context["totalItems"]) || array_key_exists("totalItems", $context) ? $context["totalItems"] : (function () { throw new RuntimeError('Variable "totalItems" does not exist.', 58, $this->source); })()))))), "html", null, true);
echo "</span>
<span class=\"results-found-suffix\">";
// line 59
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("results", [], "geral"), "html", null, true);
echo "</span>
</div>
</div>
";
// line 64
echo " <nav class=\"results-tabs mt-3\">
<ul class=\"results-tab-list list-unstyled d-flex mb-0 p-0 gap-1\">
";
// line 66
$context["tabMap"] = ["all" => "Todos", "news" => "Notícias", "news_reports" => "Reportagens", "programs" => "Programas", "event" => "Eventos"];
// line 73
echo " ";
// line 74
echo " ";
$context["tabOrder"] = [0 => "all", 1 => "news", 2 => "news_reports", 3 => "programs", 4 => "event"];
// line 75
echo "
";
// line 77
echo " ";
$context["ctParam"] = twig_get_attribute($this->env, $this->source, 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.', 77, $this->source); })()), "request", [], "any", false, false, false, 77), "query", [], "any", false, false, false, 77), "get", [0 => "content_type"], "method", false, false, false, 77);
// line 78
echo " ";
$context["selectedTypes"] = ((twig_test_iterable((isset($context["ctParam"]) || array_key_exists("ctParam", $context) ? $context["ctParam"] : (function () { throw new RuntimeError('Variable "ctParam" does not exist.', 78, $this->source); })()))) ? ((isset($context["ctParam"]) || array_key_exists("ctParam", $context) ? $context["ctParam"] : (function () { throw new RuntimeError('Variable "ctParam" does not exist.', 78, $this->source); })())) : ((((isset($context["ctParam"]) || array_key_exists("ctParam", $context) ? $context["ctParam"] : (function () { throw new RuntimeError('Variable "ctParam" does not exist.', 78, $this->source); })())) ? ([0 => (isset($context["ctParam"]) || array_key_exists("ctParam", $context) ? $context["ctParam"] : (function () { throw new RuntimeError('Variable "ctParam" does not exist.', 78, $this->source); })())]) : ([]))));
// line 79
echo " ";
$context["selected"] = [];
// line 80
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["selectedTypes"]) || array_key_exists("selectedTypes", $context) ? $context["selectedTypes"] : (function () { throw new RuntimeError('Variable "selectedTypes" does not exist.', 80, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["ct"]) {
// line 81
echo " ";
$context["selected"] = twig_array_merge((isset($context["selected"]) || array_key_exists("selected", $context) ? $context["selected"] : (function () { throw new RuntimeError('Variable "selected" does not exist.', 81, $this->source); })()), [0 => twig_lower_filter($this->env, $context["ct"])]);
// line 82
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ct'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 83
echo "
";
// line 85
echo " ";
$context["tabs"] = [];
// line 86
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["tabOrder"]) || array_key_exists("tabOrder", $context) ? $context["tabOrder"] : (function () { throw new RuntimeError('Variable "tabOrder" does not exist.', 86, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["tKey"]) {
// line 87
echo " ";
if (twig_get_attribute($this->env, $this->source, ($context["tabMap"] ?? null), $context["tKey"], [], "array", true, true, false, 87)) {
// line 88
echo " ";
$context["tLabel"] = twig_get_attribute($this->env, $this->source, (isset($context["tabMap"]) || array_key_exists("tabMap", $context) ? $context["tabMap"] : (function () { throw new RuntimeError('Variable "tabMap" does not exist.', 88, $this->source); })()), $context["tKey"], [], "array", false, false, false, 88);
// line 89
echo " ";
$context["cnt"] = ((twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), $context["tKey"], [], "array", true, true, false, 89)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), $context["tKey"], [], "array", false, false, false, 89), 0)) : (0));
// line 90
echo " ";
// line 91
echo " ";
$context["tabs"] = twig_array_merge((isset($context["tabs"]) || array_key_exists("tabs", $context) ? $context["tabs"] : (function () { throw new RuntimeError('Variable "tabs" does not exist.', 91, $this->source); })()), [0 => ["key" => $context["tKey"], "label" => (isset($context["tLabel"]) || array_key_exists("tLabel", $context) ? $context["tLabel"] : (function () { throw new RuntimeError('Variable "tLabel" does not exist.', 91, $this->source); })()), "count" => (isset($context["cnt"]) || array_key_exists("cnt", $context) ? $context["cnt"] : (function () { throw new RuntimeError('Variable "cnt" does not exist.', 91, $this->source); })())]]);
// line 92
echo " ";
}
// line 93
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tKey'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 94
echo "
";
// line 96
echo " ";
$context["firstTabWithResults"] = "all";
// line 97
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["tabs"]) || array_key_exists("tabs", $context) ? $context["tabs"] : (function () { throw new RuntimeError('Variable "tabs" does not exist.', 97, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["tab"]) {
// line 98
echo " ";
if ((((twig_get_attribute($this->env, $this->source, $context["tab"], "count", [], "any", false, false, false, 98) > 0) && ((isset($context["firstTabWithResults"]) || array_key_exists("firstTabWithResults", $context) ? $context["firstTabWithResults"] : (function () { throw new RuntimeError('Variable "firstTabWithResults" does not exist.', 98, $this->source); })()) == "all")) && (twig_get_attribute($this->env, $this->source, $context["tab"], "key", [], "any", false, false, false, 98) != "all"))) {
// line 99
echo " ";
$context["firstTabWithResults"] = twig_get_attribute($this->env, $this->source, $context["tab"], "key", [], "any", false, false, false, 99);
// line 100
echo " ";
}
// line 101
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tab'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 102
echo "
";
// line 104
echo " ";
$context["currentTypeCount"] = ((twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), (isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 104, $this->source); })()), [], "array", true, true, false, 104)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), (isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 104, $this->source); })()), [], "array", false, false, false, 104), 0)) : (0));
// line 105
echo " ";
// line 106
echo " ";
if (((((isset($context["currentTypeCount"]) || array_key_exists("currentTypeCount", $context) ? $context["currentTypeCount"] : (function () { throw new RuntimeError('Variable "currentTypeCount" does not exist.', 106, $this->source); })()) == 0) && ((isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 106, $this->source); })()) != "all")) && (((twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), "all", [], "array", true, true, false, 106)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), "all", [], "array", false, false, false, 106), 0)) : (0)) > 0))) {
// line 107
echo " ";
$context["currentType"] = "all";
// line 108
echo " ";
} elseif ((((isset($context["currentTypeCount"]) || array_key_exists("currentTypeCount", $context) ? $context["currentTypeCount"] : (function () { throw new RuntimeError('Variable "currentTypeCount" does not exist.', 108, $this->source); })()) == 0) && (((twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), "all", [], "array", true, true, false, 108)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["counts"] ?? null), "all", [], "array", false, false, false, 108), 0)) : (0)) == 0))) {
// line 109
echo " ";
$context["currentType"] = (isset($context["firstTabWithResults"]) || array_key_exists("firstTabWithResults", $context) ? $context["firstTabWithResults"] : (function () { throw new RuntimeError('Variable "firstTabWithResults" does not exist.', 109, $this->source); })());
// line 110
echo " ";
}
// line 111
echo "
";
// line 112
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["tabs"]) || array_key_exists("tabs", $context) ? $context["tabs"] : (function () { throw new RuntimeError('Variable "tabs" does not exist.', 112, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["tab"]) {
// line 113
echo " ";
$context["tKey"] = twig_get_attribute($this->env, $this->source, $context["tab"], "key", [], "any", false, false, false, 113);
// line 114
echo " ";
$context["tLabel"] = twig_get_attribute($this->env, $this->source, $context["tab"], "label", [], "any", false, false, false, 114);
// line 115
echo " ";
$context["linkParams"] = twig_array_merge(twig_array_merge((isset($context["routeParams"]) || array_key_exists("routeParams", $context) ? $context["routeParams"] : (function () { throw new RuntimeError('Variable "routeParams" does not exist.', 115, $this->source); })()), twig_get_attribute($this->env, $this->source, 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.', 115, $this->source); })()), "request", [], "any", false, false, false, 115), "query", [], "any", false, false, false, 115), "all", [], "any", false, false, false, 115)), ["type" => (isset($context["tKey"]) || array_key_exists("tKey", $context) ? $context["tKey"] : (function () { throw new RuntimeError('Variable "tKey" does not exist.', 115, $this->source); })()), "page" => 1]);
// line 116
echo " ";
$context["isDisabled"] = (twig_get_attribute($this->env, $this->source, $context["tab"], "count", [], "any", false, false, false, 116) == 0);
// line 117
echo " <li class=\"results-tab-item";
if (((isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 117, $this->source); })()) == (isset($context["tKey"]) || array_key_exists("tKey", $context) ? $context["tKey"] : (function () { throw new RuntimeError('Variable "tKey" does not exist.', 117, $this->source); })()))) {
echo " active";
}
if ((isset($context["isDisabled"]) || array_key_exists("isDisabled", $context) ? $context["isDisabled"] : (function () { throw new RuntimeError('Variable "isDisabled" does not exist.', 117, $this->source); })())) {
echo " disabled";
}
echo "\">
";
// line 118
if (((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 118, $this->source); })()) && !(isset($context["isDisabled"]) || array_key_exists("isDisabled", $context) ? $context["isDisabled"] : (function () { throw new RuntimeError('Variable "isDisabled" does not exist.', 118, $this->source); })()))) {
// line 119
echo " <a class=\"results-tab-link d-inline-block p-3";
if (((isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 119, $this->source); })()) == (isset($context["tKey"]) || array_key_exists("tKey", $context) ? $context["tKey"] : (function () { throw new RuntimeError('Variable "tKey" does not exist.', 119, $this->source); })()))) {
echo " active";
}
echo "\"
href=\"";
// line 120
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath((isset($context["route"]) || array_key_exists("route", $context) ? $context["route"] : (function () { throw new RuntimeError('Variable "route" does not exist.', 120, $this->source); })()), (isset($context["linkParams"]) || array_key_exists("linkParams", $context) ? $context["linkParams"] : (function () { throw new RuntimeError('Variable "linkParams" does not exist.', 120, $this->source); })())), "html", null, true);
echo "\">
<span class=\"results-tab-text\">";
// line 121
echo twig_escape_filter($this->env, (isset($context["tLabel"]) || array_key_exists("tLabel", $context) ? $context["tLabel"] : (function () { throw new RuntimeError('Variable "tLabel" does not exist.', 121, $this->source); })()), "html", null, true);
echo "</span>
<span class=\"results-tab-count\">(";
// line 122
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tab"], "count", [], "any", false, false, false, 122), "html", null, true);
echo ")</span>
</a>
";
} else {
// line 125
echo " <span class=\"results-tab-link d-inline-block p-3";
if (((isset($context["currentType"]) || array_key_exists("currentType", $context) ? $context["currentType"] : (function () { throw new RuntimeError('Variable "currentType" does not exist.', 125, $this->source); })()) == (isset($context["tKey"]) || array_key_exists("tKey", $context) ? $context["tKey"] : (function () { throw new RuntimeError('Variable "tKey" does not exist.', 125, $this->source); })()))) {
echo " active";
}
echo "\">
<span class=\"results-tab-text\">";
// line 126
echo twig_escape_filter($this->env, (isset($context["tLabel"]) || array_key_exists("tLabel", $context) ? $context["tLabel"] : (function () { throw new RuntimeError('Variable "tLabel" does not exist.', 126, $this->source); })()), "html", null, true);
echo "</span>
<span class=\"results-tab-count\">(";
// line 127
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tab"], "count", [], "any", false, false, false, 127), "html", null, true);
echo ")</span>
</span>
";
}
// line 130
echo " </li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tab'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 132
echo " </ul>
</nav>
";
// line 136
echo " <form class=\"results-order-form d-flex align-items-center mt-4\" method=\"get\">
";
// line 138
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, 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.', 138, $this->source); })()), "request", [], "any", false, false, false, 138), "query", [], "any", false, false, false, 138), "all", [], "any", false, false, false, 138));
foreach ($context['_seq'] as $context["key"] => $context["value"]) {
// line 139
echo " ";
if (!twig_in_filter($context["key"], [0 => "order"])) {
// line 140
echo " ";
if (twig_test_iterable($context["value"])) {
// line 141
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable($context["value"]);
foreach ($context['_seq'] as $context["_key"] => $context["v"]) {
echo "<input type=\"hidden\" name=\"";
echo twig_escape_filter($this->env, $context["key"], "html", null, true);
echo "[]\" value=\"";
echo twig_escape_filter($this->env, $context["v"], "html", null, true);
echo "\">";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['v'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 142
echo " ";
} else {
// line 143
echo " <input type=\"hidden\" name=\"";
echo twig_escape_filter($this->env, $context["key"], "html", null, true);
echo "\" value=\"";
echo twig_escape_filter($this->env, $context["value"], "html", null, true);
echo "\">
";
}
// line 145
echo " ";
}
// line 146
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 147
echo " <label for=\"order_select\" class=\"mb-0 small\">Ordenar por</label>
<div class=\"select-wrapper\">
<select id=\"order_select\" name=\"order\" class=\"form-select form-select-sm\" onchange=\"this.form.submit()\">
<option value=\"relevance\" ";
// line 150
echo ((((isset($context["order"]) || array_key_exists("order", $context) ? $context["order"] : (function () { throw new RuntimeError('Variable "order" does not exist.', 150, $this->source); })()) == "relevance")) ? ("selected") : (""));
echo ">Relevância</option>
<option value=\"newest\" ";
// line 151
echo ((((isset($context["order"]) || array_key_exists("order", $context) ? $context["order"] : (function () { throw new RuntimeError('Variable "order" does not exist.', 151, $this->source); })()) == "newest")) ? ("selected") : (""));
echo ">Mais recentes</option>
<option value=\"popular\" ";
// line 152
echo ((((isset($context["order"]) || array_key_exists("order", $context) ? $context["order"] : (function () { throw new RuntimeError('Variable "order" does not exist.', 152, $this->source); })()) == "popular")) ? ("selected") : (""));
echo ">Populares</option>
</select>
<i class=\"fa-solid fa-chevron-down\"></i>
</div>
</form>
</div>
";
// line 160
echo " ";
// line 161
echo " ";
// line 162
echo " ";
// line 163
echo " <ul id=\"js-search-results-list\" class=\"search-results list-search-result\">
";
// line 164
$context["delay"] = 0;
// line 165
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["pageItems"]) || array_key_exists("pageItems", $context) ? $context["pageItems"] : (function () { throw new RuntimeError('Variable "pageItems" does not exist.', 165, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
// line 166
echo " ";
$context["pageInfotitle"] = ((twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", true, true, false, 166)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, false, 166))) : (""));
// line 167
echo " ";
$context["pageInfourl"] = ((twig_get_attribute($this->env, $this->source, $context["item"], "url", [], "any", true, true, false, 167)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "url", [], "any", false, false, false, 167))) : (""));
// line 168
echo " ";
$context["pageInfovideo"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 168), "video", [], "any", true, true, false, 168)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 168), "video", [], "any", false, false, false, 168))) : (""));
// line 169
echo " ";
$context["pageInfovideo_mobile"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 169), "video_mobile", [], "any", true, true, false, 169)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 169), "video_mobile", [], "any", false, false, false, 169))) : (""));
// line 170
echo " ";
$context["pageInfotext"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 170), "short_text", [], "any", true, true, false, 170)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 170), "short_text", [], "any", false, false, false, 170))) : (""));
// line 171
echo " ";
$context["pageInfoimage"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 171), "default_image", [], "any", true, true, false, 171)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 171), "default_image", [], "any", false, false, false, 171))) : (""));
// line 172
echo " ";
$context["pageInfoimagemobile"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 172), "default_image_mobile", [], "any", true, true, false, 172)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 172), "default_image_mobile", [], "any", false, false, false, 172))) : (""));
// line 173
echo " ";
$context["pageInfocategories"] = ((twig_get_attribute($this->env, $this->source, $context["item"], "categories", [], "any", true, true, false, 173)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "categories", [], "any", false, false, false, 173))) : (""));
// line 174
echo " ";
$context["territory"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 174), "territory", [], "any", true, true, false, 174)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 174), "territory", [], "any", false, false, false, 174))) : (""));
// line 175
echo " ";
$context["date"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 175), "date", [], "any", true, true, false, 175)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 175), "date", [], "any", false, false, false, 175))) : (""));
// line 176
echo " ";
$context["start_date"] = ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 176), "start_date", [], "any", true, true, false, 176)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "content", [], "any", false, true, false, 176), "start_date", [], "any", false, false, false, 176))) : (""));
// line 177
echo "
";
// line 179
echo " ";
$context["tagMachines"] = [];
// line 180
echo " ";
if ((twig_get_attribute($this->env, $this->source, $context["item"], "tags", [], "any", true, true, false, 180) && !twig_test_empty(twig_get_attribute($this->env, $this->source, $context["item"], "tags", [], "any", false, false, false, 180)))) {
// line 181
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["item"], "tags", [], "any", false, false, false, 181));
foreach ($context['_seq'] as $context["_key"] => $context["tag"]) {
// line 182
echo " ";
$context["machine"] = ((twig_get_attribute($this->env, $this->source, $context["tag"], "machineName", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "machineName", [], "any", false, false, false, 182), ((twig_get_attribute($this->env, $this->source, $context["tag"], "machine", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "machine", [], "any", false, false, false, 182), ((twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", false, false, false, 182), $context["tag"])) : ($context["tag"])))) : (((twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", false, false, false, 182), $context["tag"])) : ($context["tag"])))))) : (((twig_get_attribute($this->env, $this->source, $context["tag"], "machine", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "machine", [], "any", false, false, false, 182), ((twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", false, false, false, 182), $context["tag"])) : ($context["tag"])))) : (((twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", true, true, false, 182)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tag"], "slug", [], "any", false, false, false, 182), $context["tag"])) : ($context["tag"]))))));
// line 183
echo " ";
$context["tagMachines"] = twig_array_merge((isset($context["tagMachines"]) || array_key_exists("tagMachines", $context) ? $context["tagMachines"] : (function () { throw new RuntimeError('Variable "tagMachines" does not exist.', 183, $this->source); })()), [0 => (isset($context["machine"]) || array_key_exists("machine", $context) ? $context["machine"] : (function () { throw new RuntimeError('Variable "machine" does not exist.', 183, $this->source); })())]);
// line 184
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tag'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 185
echo " ";
}
// line 186
echo "
";
// line 188
echo " ";
$context["pageId"] = (((twig_get_attribute($this->env, $this->source, $context["item"], "pageId", [], "any", true, true, false, 188) && twig_get_attribute($this->env, $this->source, $context["item"], "pageId", [], "any", false, false, false, 188))) ? (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["item"], "pageId", [], "any", false, false, false, 188), "id", [], "any", false, false, false, 188)) : (null));
// line 189
echo " ";
$context["pageInfo"] = (((isset($context["pageId"]) || array_key_exists("pageId", $context) ? $context["pageId"] : (function () { throw new RuntimeError('Variable "pageId" does not exist.', 189, $this->source); })())) ? (_twig_default_filter($this->extensions['App\Twig\AppExtension']->getPageInfo(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.', 189, $this->source); })()), "request", [], "any", false, false, false, 189), "locale", [], "any", false, false, false, 189), (isset($context["pageId"]) || array_key_exists("pageId", $context) ? $context["pageId"] : (function () { throw new RuntimeError('Variable "pageId" does not exist.', 189, $this->source); })()), true, "Temas"), null)) : (null));
// line 190
echo " ";
$context["categories"] = ((( !(null === (isset($context["pageInfo"]) || array_key_exists("pageInfo", $context) ? $context["pageInfo"] : (function () { throw new RuntimeError('Variable "pageInfo" does not exist.', 190, $this->source); })())) && twig_get_attribute($this->env, $this->source, ($context["pageInfo"] ?? null), "categories", [], "any", true, true, false, 190))) ? (twig_get_attribute($this->env, $this->source, (isset($context["pageInfo"]) || array_key_exists("pageInfo", $context) ? $context["pageInfo"] : (function () { throw new RuntimeError('Variable "pageInfo" does not exist.', 190, $this->source); })()), "categories", [], "any", false, false, false, 190)) : ([]));
// line 191
echo " ";
$context["exclusiveTag"] = ((((isset($context["pageInfo"]) || array_key_exists("pageInfo", $context) ? $context["pageInfo"] : (function () { throw new RuntimeError('Variable "pageInfo" does not exist.', 191, $this->source); })()) && twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["pageInfo"] ?? null), "page", [], "any", false, true, false, 191), "tags", [], "any", true, true, false, 191))) ? (_twig_default_filter(twig_first($this->env, twig_array_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["pageInfo"]) || array_key_exists("pageInfo", $context) ? $context["pageInfo"] : (function () { throw new RuntimeError('Variable "pageInfo" does not exist.', 191, $this->source); })()), "page", [], "any", false, false, false, 191), "tags", [], "any", false, false, false, 191), function ($__t__) use ($context, $macros) { $context["t"] = $__t__; return (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["t"]) || array_key_exists("t", $context) ? $context["t"] : (function () { throw new RuntimeError('Variable "t" does not exist.', 191, $this->source); })()), "domainValue", [], "any", false, false, false, 191), "type", [], "any", false, false, false, 191), "name", [], "any", false, false, false, 191) == "Exclusive"); })), null)) : (null));
// line 192
echo " ";
$context["maxVisible"] = 1;
// line 193
echo "
<li ";
// line 194
if (((twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "is_animated", [], "any", true, true, false, 194)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "is_animated", [], "any", false, false, false, 194))) : (""))) {
echo "data-aos=\"";
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "animation_type", [], "any", true, true, false, 194)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "animation_type", [], "any", false, false, false, 194), "fade")) : ("fade")), "html", null, true);
echo "\"
data-aos-delay=\"";
// line 195
echo twig_escape_filter($this->env, (isset($context["delay"]) || array_key_exists("delay", $context) ? $context["delay"] : (function () { throw new RuntimeError('Variable "delay" does not exist.', 195, $this->source); })()), "html", null, true);
echo "\"";
}
echo " class=\"item\"
data-type=\"";
// line 196
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["item"], "getNormalizedContentTypeKey", [], "any", true, true, false, 196)) ? (twig_get_attribute($this->env, $this->source, $context["item"], "getNormalizedContentTypeKey", [], "method", false, false, false, 196)) : ((((twig_get_attribute($this->env, $this->source, $context["item"], "getNormalizedContentTypeKey", [], "method", true, true, false, 196) && !(null === twig_get_attribute($this->env, $this->source, $context["item"], "getNormalizedContentTypeKey", [], "method", false, false, false, 196)))) ? (twig_get_attribute($this->env, $this->source, $context["item"], "getNormalizedContentTypeKey", [], "method", false, false, false, 196)) : ("")))), "html", null, true);
echo "\"
data-tags=\"";
// line 197
echo twig_escape_filter($this->env, twig_join_filter((isset($context["tagMachines"]) || array_key_exists("tagMachines", $context) ? $context["tagMachines"] : (function () { throw new RuntimeError('Variable "tagMachines" does not exist.', 197, $this->source); })()), ","), "html", null, true);
echo "\">
<a href=\"";
// line 198
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["item"], "canonicalUrl", [], "any", true, true, false, 198)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "canonicalUrl", [], "any", false, false, false, 198), "#")) : ("#")), "html", null, true);
echo "\">
<div class=\"image-container event-card-carousel\">
<picture>
";
// line 201
$context["image"] = ((array_key_exists("pageInfoimage", $context)) ? (_twig_default_filter((isset($context["pageInfoimage"]) || array_key_exists("pageInfoimage", $context) ? $context["pageInfoimage"] : (function () { throw new RuntimeError('Variable "pageInfoimage" does not exist.', 201, $this->source); })()), null)) : (null));
// line 202
echo " ";
if (twig_test_empty((isset($context["image"]) || array_key_exists("image", $context) ? $context["image"] : (function () { throw new RuntimeError('Variable "image" does not exist.', 202, $this->source); })()))) {
// line 203
echo " ";
$context["image"] = "/uploads/system/placeholder-vertical.png";
// line 204
echo " ";
}
// line 205
echo " <img src=\"";
echo twig_escape_filter($this->env, urldecode($this->extensions['App\Bundles\Liip\ImagineBundle\Templating\AppFilterExtension']->filter((isset($context["image"]) || array_key_exists("image", $context) ? $context["image"] : (function () { throw new RuntimeError('Variable "image" does not exist.', 205, $this->source); })()), "poster")), "html", null, true);
echo "\"
loading=\"lazy\"
alt=\"";
// line 207
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", true, true, false, 207)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, false, 207), "")) : ("")), "html", null, true);
echo "\"
title=\"";
// line 208
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["item"], "image_title", [], "any", true, true, false, 208)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "image_title", [], "any", false, false, false, 208), ((twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", true, true, false, 208)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, false, 208), "")) : ("")))) : (((twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", true, true, false, 208)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, false, 208), "")) : ("")))), "html", null, true);
echo "\">
</picture>
";
// line 216
echo "
";
// line 217
if ((isset($context["pageInfovideo"]) || array_key_exists("pageInfovideo", $context) ? $context["pageInfovideo"] : (function () { throw new RuntimeError('Variable "pageInfovideo" does not exist.', 217, $this->source); })())) {
// line 218
echo " <div class=\"card card-blur icon\">
";
// line 219
echo $this->extensions['App\Twig\AppExtension']->fileGetContents($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("custom/player-icon.svg", "global"));
echo "
</div>
";
}
// line 222
echo "
</div>
<div class=\"caption\">
<h3 class=\"card-title\">
";
// line 227
echo twig_escape_filter($this->env, (((twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", true, true, false, 227) && !twig_test_empty(twig_get_attribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, false, 227)))) ? ((((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, // line 228
$context["item"], "title", [], "any", false, false, false, 228)) <= 80)) ? (twig_get_attribute($this->env, $this->source, // line 229
$context["item"], "title", [], "any", false, false, false, 229)) : ((twig_slice($this->env, twig_get_attribute($this->env, $this->source, // line 230
$context["item"], "title", [], "any", false, false, false, 230), 0, 80) . "...")))) : (("Event Title " . // line 231
(isset($context["i"]) || array_key_exists("i", $context) ? $context["i"] : (function () { throw new RuntimeError('Variable "i" does not exist.', 231, $this->source); })())))), "html", null, true);
echo "
</h3>
";
// line 234
if ((isset($context["pageInfovideo"]) || array_key_exists("pageInfovideo", $context) ? $context["pageInfovideo"] : (function () { throw new RuntimeError('Variable "pageInfovideo" does not exist.', 234, $this->source); })())) {
// line 235
echo " <div class=\"category\">
";
// line 236
echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["item"], "category", [], "any", true, true, false, 236)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["item"], "category", [], "any", false, false, false, 236), "")) : ("")), "html", null, true);
echo "
</div>
";
}
// line 239
echo "
";
// line 241
echo " ";
echo twig_call_macro($macros["macros"], "macro_renderCategoryPopover", [(isset($context["categories"]) || array_key_exists("categories", $context) ? $context["categories"] : (function () { throw new RuntimeError('Variable "categories" does not exist.', 241, $this->source); })()), (isset($context["maxVisible"]) || array_key_exists("maxVisible", $context) ? $context["maxVisible"] : (function () { throw new RuntimeError('Variable "maxVisible" does not exist.', 241, $this->source); })()), false, (isset($context["exclusiveTag"]) || array_key_exists("exclusiveTag", $context) ? $context["exclusiveTag"] : (function () { throw new RuntimeError('Variable "exclusiveTag" does not exist.', 241, $this->source); })()), (isset($context["languagecode"]) || array_key_exists("languagecode", $context) ? $context["languagecode"] : (function () { throw new RuntimeError('Variable "languagecode" does not exist.', 241, $this->source); })()), "categories-list"], 241, $context, $this->getSourceContext());
echo "
";
// line 244
echo " <div class=\"date\" title=\"";
echo twig_escape_filter($this->env, (((isset($context["start_date"]) || array_key_exists("start_date", $context) ? $context["start_date"] : (function () { throw new RuntimeError('Variable "start_date" does not exist.', 244, $this->source); })())) ? (twig_date_format_filter($this->env, (isset($context["start_date"]) || array_key_exists("start_date", $context) ? $context["start_date"] : (function () { throw new RuntimeError('Variable "start_date" does not exist.', 244, $this->source); })()), "d/m/Y")) : (twig_date_format_filter($this->env, (isset($context["date"]) || array_key_exists("date", $context) ? $context["date"] : (function () { throw new RuntimeError('Variable "date" does not exist.', 244, $this->source); })()), "d/m/Y"))), "html", null, true);
echo "\">
";
// line 245
$context["tz"] = "Europe/Lisbon";
// line 246
echo " ";
$context["dateValue"] = (((isset($context["start_date"]) || array_key_exists("start_date", $context) ? $context["start_date"] : (function () { throw new RuntimeError('Variable "start_date" does not exist.', 246, $this->source); })())) ? ((isset($context["start_date"]) || array_key_exists("start_date", $context) ? $context["start_date"] : (function () { throw new RuntimeError('Variable "start_date" does not exist.', 246, $this->source); })())) : ((isset($context["date"]) || array_key_exists("date", $context) ? $context["date"] : (function () { throw new RuntimeError('Variable "date" does not exist.', 246, $this->source); })())));
// line 247
echo " ";
$context["fmt"] = (((is_string($__internal_compile_0 = 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.', 247, $this->source); })()), "request", [], "any", false, false, false, 247), "locale", [], "any", false, false, false, 247)) && is_string($__internal_compile_1 = "en") && ('' === $__internal_compile_1 || 0 === strpos($__internal_compile_0, $__internal_compile_1)))) ? ("MMM d yyyy") : ("d MMM Y"));
// line 248
echo " ";
echo $this->extensions['App\Twig\AppExtension']->fileGetContents($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("custom/time-icon.svg", "global"));
echo "
";
// line 249
echo twig_escape_filter($this->env, twig_localized_date_filter($this->env, (isset($context["dateValue"]) || array_key_exists("dateValue", $context) ? $context["dateValue"] : (function () { throw new RuntimeError('Variable "dateValue" does not exist.', 249, $this->source); })()), "none", "none", 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.', 249, $this->source); })()), "request", [], "any", false, false, false, 249), "locale", [], "any", false, false, false, 249), (isset($context["tz"]) || array_key_exists("tz", $context) ? $context["tz"] : (function () { throw new RuntimeError('Variable "tz" does not exist.', 249, $this->source); })()), (isset($context["fmt"]) || array_key_exists("fmt", $context) ? $context["fmt"] : (function () { throw new RuntimeError('Variable "fmt" does not exist.', 249, $this->source); })())), "html", null, true);
echo "
</div>
</div>
</a>
</li>
";
// line 256
$context["delay"] = ((isset($context["delay"]) || array_key_exists("delay", $context) ? $context["delay"] : (function () { throw new RuntimeError('Variable "delay" does not exist.', 256, $this->source); })()) + 150);
// line 257
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 258
echo " </ul>
";
// line 259
if (((twig_get_attribute($this->env, $this->source, 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.', 259, $this->source); })()), "request", [], "any", false, false, false, 259), "query", [], "any", false, false, false, 259), "get", [0 => "isajax"], "method", false, false, false, 259) != "1") && ((isset($context["nextPage"]) || array_key_exists("nextPage", $context) ? $context["nextPage"] : (function () { throw new RuntimeError('Variable "nextPage" does not exist.', 259, $this->source); })()) > 0))) {
// line 260
echo " <div class=\"load-more-wrapper text-center mt-4\">
<button id=\"js-load-more-results\"
class=\"btn-primary btn-style-1 btn-load-more\"
data-current-page=\"";
// line 263
echo twig_escape_filter($this->env, (isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 263, $this->source); })()), "html", null, true);
echo "\"
data-total-pages=\"";
// line 264
echo twig_escape_filter($this->env, (isset($context["pageCount"]) || array_key_exists("pageCount", $context) ? $context["pageCount"] : (function () { throw new RuntimeError('Variable "pageCount" does not exist.', 264, $this->source); })()), "html", null, true);
echo "\"
data-next-page=\"";
// line 265
echo twig_escape_filter($this->env, (isset($context["nextPage"]) || array_key_exists("nextPage", $context) ? $context["nextPage"] : (function () { throw new RuntimeError('Variable "nextPage" does not exist.', 265, $this->source); })()), "html", null, true);
echo "\"
type=\"button\">
<span class=\"label\">";
// line 267
echo twig_escape_filter($this->env, _twig_default_filter($this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("see_more", [], "custom"), "Ver mais"), "html", null, true);
echo "</span>
<span class=\"spinner d-none\" aria-hidden=\"true\"></span>
</button>
</div>
<script>
(function () {
const btn = document.getElementById('js-load-more-results');
const list = document.getElementById('js-search-results-list');
if (!btn || !list) return;
let loading = false;
function buildUrl(p) {
const url = new URL(window.location.href);
url.searchParams.set('page', p);
url.searchParams.set('isajax', '1');
return url.toString();
}
function show() {
btn.disabled = true;
btn.classList.add('is-loading');
const sp = btn.querySelector('.spinner');
sp && sp.classList.remove('d-none');
}
function hide() {
btn.disabled = false;
btn.classList.remove('is-loading');
const sp = btn.querySelector('.spinner');
sp && sp.classList.add('d-none');
}
async function load() {
if (loading) return;
loading = true;
show();
const next = parseInt(btn.getAttribute('data-next-page'), 10);
const total = parseInt(btn.getAttribute('data-total-pages'), 10);
try {
const r = await fetch(buildUrl(next), {headers: {'X-Requested-With': 'XMLHttpRequest'}});
if (!r.ok) throw new Error(r.status);
const html = await r.text();
const tmp = document.createElement('div');
tmp.innerHTML = html;
const fragUl = tmp.querySelector('#js-search-results-list');
const items = fragUl ? fragUl.querySelectorAll('li') : tmp.querySelectorAll('li.item');
items.forEach(li => {
const id = li.getAttribute('data-id');
if (!list.querySelector(`[data-id=\"\${id}\"]`)) {
li.classList.add('appended');
list.appendChild(li);
}
});
if (next >= total) {
btn.remove();
} else {
btn.setAttribute('data-current-page', String(next));
btn.setAttribute('data-next-page', String(next + 1));
}
} catch (e) {
console.error('Load more failed', e);
btn.classList.add('error');
} finally {
hide();
loading = false;
}
}
btn.addEventListener('click', function (e) {
e.preventDefault();
load();
});
})();
</script>
";
}
// line 342
echo "
";
}
// line 345
echo " </div>
</section>
";
}
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
public function getTemplateName()
{
return "blocks/B51_search_results/B51_search_results.default.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 797 => 345, 792 => 342, 714 => 267, 709 => 265, 705 => 264, 701 => 263, 696 => 260, 694 => 259, 691 => 258, 685 => 257, 683 => 256, 673 => 249, 668 => 248, 665 => 247, 662 => 246, 660 => 245, 655 => 244, 649 => 241, 646 => 239, 640 => 236, 637 => 235, 635 => 234, 629 => 231, 628 => 230, 627 => 229, 626 => 228, 625 => 227, 618 => 222, 612 => 219, 609 => 218, 607 => 217, 604 => 216, 599 => 208, 595 => 207, 589 => 205, 586 => 204, 583 => 203, 580 => 202, 578 => 201, 572 => 198, 568 => 197, 564 => 196, 558 => 195, 552 => 194, 549 => 193, 546 => 192, 543 => 191, 540 => 190, 537 => 189, 534 => 188, 531 => 186, 528 => 185, 522 => 184, 519 => 183, 516 => 182, 511 => 181, 508 => 180, 505 => 179, 502 => 177, 499 => 176, 496 => 175, 493 => 174, 490 => 173, 487 => 172, 484 => 171, 481 => 170, 478 => 169, 475 => 168, 472 => 167, 469 => 166, 464 => 165, 462 => 164, 459 => 163, 457 => 162, 455 => 161, 453 => 160, 443 => 152, 439 => 151, 435 => 150, 430 => 147, 424 => 146, 421 => 145, 413 => 143, 410 => 142, 396 => 141, 393 => 140, 390 => 139, 385 => 138, 382 => 136, 377 => 132, 370 => 130, 364 => 127, 360 => 126, 353 => 125, 347 => 122, 343 => 121, 339 => 120, 332 => 119, 330 => 118, 320 => 117, 317 => 116, 314 => 115, 311 => 114, 308 => 113, 304 => 112, 301 => 111, 298 => 110, 295 => 109, 292 => 108, 289 => 107, 286 => 106, 284 => 105, 281 => 104, 278 => 102, 272 => 101, 269 => 100, 266 => 99, 263 => 98, 258 => 97, 255 => 96, 252 => 94, 246 => 93, 243 => 92, 240 => 91, 238 => 90, 235 => 89, 232 => 88, 229 => 87, 224 => 86, 221 => 85, 218 => 83, 212 => 82, 209 => 81, 204 => 80, 201 => 79, 198 => 78, 195 => 77, 192 => 75, 189 => 74, 187 => 73, 185 => 66, 181 => 64, 174 => 59, 170 => 58, 163 => 54, 159 => 53, 153 => 52, 148 => 50, 145 => 49, 142 => 48, 139 => 47, 136 => 46, 133 => 45, 130 => 44, 128 => 43, 125 => 42, 123 => 41, 121 => 40, 118 => 38, 116 => 37, 113 => 35, 110 => 34, 107 => 33, 104 => 32, 101 => 31, 98 => 30, 95 => 29, 92 => 28, 89 => 27, 86 => 26, 83 => 25, 80 => 24, 77 => 23, 75 => 21, 74 => 20, 73 => 16, 72 => 15, 71 => 14, 70 => 12, 68 => 11, 66 => 10, 64 => 9, 62 => 8, 56 => 6, 54 => 5, 48 => 3, 45 => 2, 43 => 1,);
}
public function getSourceContext()
{
return new Source("{% if hasGeneralSearch %}
{% import 'blocks\\\\macros.html.twig' as macros %}
<section class=\"block-search-results\" {{ macros.getBlockDataAttributes(_context) }}>
<div class=\"container\">
{% if values|length == 0 %}
{{ 'zerorecords'|trans([],'studio') }}
{% else %}
{# ---------------------------------------------- #}
{# Prepare data: items collection & type counts #}
{# ---------------------------------------------- #}
{% set resultsMeta = results is defined ? results : {
'items': values.items is defined ? values.items : values,
'counts': {'news':0,'news_reports':0,'programs':0,'event':0,'all':0},
'currentType': app.request.query.get('type')|default('all'),
'order': app.request.query.get('order')|default('relevance'),
'page': (app.request.query.get('page')|default(1)) + 0,
'pageSize': 15,
'pageCount': 1,
'nextPage': 0,
'total': (values.items is defined ? values.items|length : values|length),
'totalAll': (values.items is defined ? values.items|length : values|length)
} %}
{% set items = resultsMeta.items %}
{% set counts = resultsMeta.counts %}
{% set currentType = resultsMeta.currentType %}
{% set order = resultsMeta.order %}
{% set route = app.request.attributes.get('_route') %}
{% set routeParams = app.request.attributes.get('_route_params')|default({}) %}
{% set currentPage = resultsMeta.page %}
{% set pageSize = resultsMeta.pageSize %}
{% set pageCount = resultsMeta.pageCount %}
{% set nextPage = resultsMeta.nextPage %}
{% set totalItems = resultsMeta.total %}
{% set pageItems = items %}
{# --- Server-side filtering (tags[]=machine, themes[]=label) --- #}
{# Backend now applies tags[] and themes[] filtering; template no longer re-filters #}
{# ---------------------------------------------- #}
{# Results header (counts + ordering) #}
{# ---------------------------------------------- #}
{% if app.request.query.get('p') %}
{% set resultString = '<h1 class=\"results-title\">Conta lá <span>' ~ app.request.query.get('p') ~ '</span></h1>' %}
{% elseif app.request.query.get('themes') %}
{% set themes = app.request.query.get('themes') %}
{% set resultString = '<h1 class=\"results-title\">Conta lá <span>' ~ (themes|length == 1 ? themes[0] : themes|join(', ')) ~ '</span></h1>' %}
{% endif %}
{{ resultString|default|raw }}
<div class=\"results-bar mb-4\" data-current-page=\"{{ currentPage }}\" data-page-count=\"{{ pageCount }}\"
data-page-size=\"{{ pageSize }}\"
data-total-all=\"{{ resultsMeta.totalAll is defined ? resultsMeta.totalAll : (total is defined ? total : totalItems) }}\">
<div class=\"results-bar-top d-flex flex-column flex-md-row justify-content-between align-items-md-center gap-3\">
<div class=\"results-stats\">
<span class=\"results-found-prefix\">Encontrados</span>
<span class=\"results-total\">{{ resultsMeta.totalAll is defined ? resultsMeta.totalAll : (total is defined ? total : totalItems) }}</span>
<span class=\"results-found-suffix\">{{ 'results'|trans ({},'geral') }}</span>
</div>
</div>
{# Tabs #}
<nav class=\"results-tabs mt-3\">
<ul class=\"results-tab-list list-unstyled d-flex mb-0 p-0 gap-1\">
{% set tabMap = {
'all': 'Todos',
'news': 'Notícias',
'news_reports': 'Reportagens',
'programs': 'Programas',
'event': 'Eventos'
} %}
{# Define the order we want to display tabs #}
{% set tabOrder = ['all', 'news', 'news_reports', 'programs', 'event'] %}
{# restrict by content_type[] when provided #}
{% set ctParam = app.request.query.get('content_type') %}
{% set selectedTypes = ctParam is iterable ? ctParam : (ctParam ? [ctParam] : []) %}
{% set selected = [] %}
{% for ct in selectedTypes %}
{% set selected = selected|merge([ct|lower]) %}
{% endfor %}
{# build tab objects in the specified order, showing all tabs #}
{% set tabs = [] %}
{% for tKey in tabOrder %}
{% if tabMap[tKey] is defined %}
{% set tLabel = tabMap[tKey] %}
{% set cnt = counts[tKey]|default(0) %}
{# Always add the tab, regardless of count or selection #}
{% set tabs = tabs|merge([{'key': tKey, 'label': tLabel, 'count': cnt}]) %}
{% endif %}
{% endfor %}
{# Find the first tab with count > 0 to auto-select if current type has no results #}
{% set firstTabWithResults = 'all' %}
{% for tab in tabs %}
{% if tab.count > 0 and firstTabWithResults == 'all' and tab.key != 'all' %}
{% set firstTabWithResults = tab.key %}
{% endif %}
{% endfor %}
{# Auto-select \"Todos\" tab by default, or first tab with results if \"Todos\" has no results #}
{% set currentTypeCount = counts[currentType]|default(0) %}
{# Don't override currentType if it's already set correctly by the backend #}
{% if currentTypeCount == 0 and currentType != 'all' and counts['all']|default(0) > 0 %}
{% set currentType = 'all' %}
{% elseif currentTypeCount == 0 and counts['all']|default(0) == 0 %}
{% set currentType = firstTabWithResults %}
{% endif %}
{% for tab in tabs %}
{% set tKey = tab.key %}
{% set tLabel = tab.label %}
{% set linkParams = routeParams|merge(app.request.query.all)|merge({'type': tKey, 'page': 1}) %}
{% set isDisabled = tab.count == 0 %}
<li class=\"results-tab-item{% if currentType == tKey %} active{% endif %}{% if isDisabled %} disabled{% endif %}\">
{% if route and not isDisabled %}
<a class=\"results-tab-link d-inline-block p-3{% if currentType == tKey %} active{% endif %}\"
href=\"{{ path(route, linkParams) }}\">
<span class=\"results-tab-text\">{{ tLabel }}</span>
<span class=\"results-tab-count\">({{ tab.count }})</span>
</a>
{% else %}
<span class=\"results-tab-link d-inline-block p-3{% if currentType == tKey %} active{% endif %}\">
<span class=\"results-tab-text\">{{ tLabel }}</span>
<span class=\"results-tab-count\">({{ tab.count }})</span>
</span>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{# Ordering form #}
<form class=\"results-order-form d-flex align-items-center mt-4\" method=\"get\">
{# preserve all current query params except order #}
{% for key,value in app.request.query.all %}
{% if key not in ['order'] %}
{% if value is iterable %}
{% for v in value %}<input type=\"hidden\" name=\"{{ key }}[]\" value=\"{{ v }}\">{% endfor %}
{% else %}
<input type=\"hidden\" name=\"{{ key }}\" value=\"{{ value }}\">
{% endif %}
{% endif %}
{% endfor %}
<label for=\"order_select\" class=\"mb-0 small\">Ordenar por</label>
<div class=\"select-wrapper\">
<select id=\"order_select\" name=\"order\" class=\"form-select form-select-sm\" onchange=\"this.form.submit()\">
<option value=\"relevance\" {{ order == 'relevance' ? 'selected' }}>Relevância</option>
<option value=\"newest\" {{ order == 'newest' ? 'selected' }}>Mais recentes</option>
<option value=\"popular\" {{ order == 'popular' ? 'selected' }}>Populares</option>
</select>
<i class=\"fa-solid fa-chevron-down\"></i>
</div>
</form>
</div>
{# ---------------------------------------------- #}
{# Results grid list #}
{# ---------------------------------------------- #}
{# Results list wrapper (AJAX will append <li> items) #}
<ul id=\"js-search-results-list\" class=\"search-results list-search-result\">
{% set delay = 0 %}
{% for item in pageItems %}
{% set pageInfotitle = item.title|default %}
{% set pageInfourl = item.url|default %}
{% set pageInfovideo = item.content.video|default %}
{% set pageInfovideo_mobile = item.content.video_mobile|default %}
{% set pageInfotext = item.content.short_text|default %}
{% set pageInfoimage = item.content.default_image|default %}
{% set pageInfoimagemobile = item.content.default_image_mobile|default %}
{% set pageInfocategories = item.categories|default %}
{% set territory = item.content.territory|default %}
{% set date = item.content.date|default %}
{% set start_date = item.content.start_date|default %}
{# Collect tag machines (fallback to id) for filtering #}
{% set tagMachines = [] %}
{% if item.tags is defined and item.tags is not empty %}
{% for tag in item.tags %}
{% set machine = tag.machineName|default(tag.machine|default(tag.slug|default(tag))) %}
{% set tagMachines = tagMachines|merge([ machine ]) %}
{% endfor %}
{% endif %}
{# Get categories (Temas) for this item #}
{% set pageId = item.pageId is defined and item.pageId ? item.pageId.id : null %}
{% set pageInfo = pageId ? get_page_info(app.request.locale, pageId, true, \"Temas\")|default(null) : null %}
{% set categories = (pageInfo is not null and pageInfo.categories is defined) ? pageInfo.categories : [] %}
{% set exclusiveTag = pageInfo and pageInfo.page.tags is defined ? pageInfo.page.tags|filter(t => t.domainValue.type.name == 'Exclusive')|first|default(null) : null %}
{% set maxVisible = 1 %}
<li {% if settings.is_animated|default %}data-aos=\"{{ settings.animation_type|default(\"fade\") }}\"
data-aos-delay=\"{{ delay }}\"{% endif %} class=\"item\"
data-type=\"{{ item.getNormalizedContentTypeKey is defined ? item.getNormalizedContentTypeKey() : (item.getNormalizedContentTypeKey() ?? '') }}\"
data-tags=\"{{ tagMachines|join(',') }}\">
<a href=\"{{ item.canonicalUrl|default('#') }}\">
<div class=\"image-container event-card-carousel\">
<picture>
{% set image = pageInfoimage|default(null) %}
{% if image is empty %}
{% set image = '/uploads/system/placeholder-vertical.png' %}
{% endif %}
<img src=\"{{ (image)|imagine_filter('poster')|urldecode }}\"
loading=\"lazy\"
alt=\"{{ item.title|default('') }}\"
title=\"{{ item.image_title|default(item.title|default('')) }}\">
</picture>
{# <form>
<input type=\"hidden\" name=\"highlight_id\">
<button type=\"submit\" class=\"favorites-button js-favorites-button\">
{{ file_get_contents(asset('custom/favorites-icon.svg', 'global'))|raw }}
</button>
</form> #}
{% if pageInfovideo %}
<div class=\"card card-blur icon\">
{{ file_get_contents(asset('custom/player-icon.svg', 'global'))|raw }}
</div>
{% endif %}
</div>
<div class=\"caption\">
<h3 class=\"card-title\">
{{ item.title is defined and item.title is not empty
? (item.title|length <= 80
? item.title
: item.title|slice(0, 80) ~ '...')
: 'Event Title ' ~ i }}
</h3>
{% if pageInfovideo %}
<div class=\"category\">
{{ item.category|default('') }}
</div>
{% endif %}
{# temas #}
{{ macros.renderCategoryPopover(categories, maxVisible, false, exclusiveTag, languagecode, 'categories-list') }}
{# date #}
<div class=\"date\" title=\"{{ start_date ? start_date|date('d/m/Y') : date|date('d/m/Y') }}\">
{% set tz = 'Europe/Lisbon' %}
{% set dateValue = start_date ? start_date : date %}
{% set fmt = app.request.locale starts with('en') ? 'MMM d yyyy' : 'd MMM Y' %}
{{ file_get_contents(asset('custom/time-icon.svg', 'global'))|raw }}
{{ dateValue|localizeddate('none', 'none', app.request.locale, tz, fmt) }}
</div>
</div>
</a>
</li>
{% set delay = delay + 150 %}
{% endfor %}
</ul>
{% if app.request.query.get('isajax') != '1' and nextPage > 0 %}
<div class=\"load-more-wrapper text-center mt-4\">
<button id=\"js-load-more-results\"
class=\"btn-primary btn-style-1 btn-load-more\"
data-current-page=\"{{ currentPage }}\"
data-total-pages=\"{{ pageCount }}\"
data-next-page=\"{{ nextPage }}\"
type=\"button\">
<span class=\"label\">{{ 'see_more'|trans({}, 'custom')|default('Ver mais') }}</span>
<span class=\"spinner d-none\" aria-hidden=\"true\"></span>
</button>
</div>
<script>
(function () {
const btn = document.getElementById('js-load-more-results');
const list = document.getElementById('js-search-results-list');
if (!btn || !list) return;
let loading = false;
function buildUrl(p) {
const url = new URL(window.location.href);
url.searchParams.set('page', p);
url.searchParams.set('isajax', '1');
return url.toString();
}
function show() {
btn.disabled = true;
btn.classList.add('is-loading');
const sp = btn.querySelector('.spinner');
sp && sp.classList.remove('d-none');
}
function hide() {
btn.disabled = false;
btn.classList.remove('is-loading');
const sp = btn.querySelector('.spinner');
sp && sp.classList.add('d-none');
}
async function load() {
if (loading) return;
loading = true;
show();
const next = parseInt(btn.getAttribute('data-next-page'), 10);
const total = parseInt(btn.getAttribute('data-total-pages'), 10);
try {
const r = await fetch(buildUrl(next), {headers: {'X-Requested-With': 'XMLHttpRequest'}});
if (!r.ok) throw new Error(r.status);
const html = await r.text();
const tmp = document.createElement('div');
tmp.innerHTML = html;
const fragUl = tmp.querySelector('#js-search-results-list');
const items = fragUl ? fragUl.querySelectorAll('li') : tmp.querySelectorAll('li.item');
items.forEach(li => {
const id = li.getAttribute('data-id');
if (!list.querySelector(`[data-id=\"\${id}\"]`)) {
li.classList.add('appended');
list.appendChild(li);
}
});
if (next >= total) {
btn.remove();
} else {
btn.setAttribute('data-current-page', String(next));
btn.setAttribute('data-next-page', String(next + 1));
}
} catch (e) {
console.error('Load more failed', e);
btn.classList.add('error');
} finally {
hide();
loading = false;
}
}
btn.addEventListener('click', function (e) {
e.preventDefault();
load();
});
})();
</script>
{% endif %}
{% endif %}
</div>
</section>
{% endif %}
", "blocks/B51_search_results/B51_search_results.default.html.twig", "/var/www/html/theme/templates/blocks/B51_search_results/B51_search_results.default.html.twig");
}
}