issue #2001 make sure TAGS tpl variable is always set

This commit is contained in:
plegall
2023-10-24 15:14:38 +02:00
parent 2e3ed57b24
commit c94313fdc3
2 changed files with 5 additions and 4 deletions

View File

@@ -201,6 +201,7 @@ if ( empty($page['is_external']) )
if (isset($my_search['fields']['tags']))
{
$filter_tags = $filter_tag_ids = array();
// TODO calling get_available_tags(), with lots of photos/albums/tags may cost time,
// we should reuse the result if already executed (for building the menu for example)
if (isset($search_items))
@@ -213,18 +214,16 @@ if ( empty($page['is_external']) )
usort($filter_tags, 'tag_alpha_compare');
}
$filter_tag_ids = array();
if (count($filter_tags) > 0)
{
$template->assign('TAGS', $filter_tags);
foreach ($filter_tags as $tag)
{
$filter_tag_ids[] = $tag['id'];
}
}
$template->assign('TAGS', $filter_tags);
// in case the search has forbidden tags for current user, we need to filter the search rule
$my_search['fields']['tags']['words'] = array_intersect($my_search['fields']['tags']['words'], $filter_tag_ids);
}

View File

@@ -133,6 +133,7 @@ str_empty_search_bot_alt = "{'Pre-established filters are proposed, but you can
</div>
</div>
</div>
{if isset($TAGS)}
<div class="filter filter-tag">
<span class="mcs-icon pwg-icon-tag filter-icon"></span>
<span class="search-words"></span>
@@ -167,6 +168,7 @@ str_empty_search_bot_alt = "{'Pre-established filters are proposed, but you can
</div>
</div>
</div>
{/if}
{if isset($DATE_POSTED)}
<div class="filter filter-date_posted">