Map tags: load live organization tags and sanitize selections

This commit is contained in:
Jürgen Mummert
2026-02-26 22:00:12 +01:00
parent 1a4811cb02
commit 51a92ea45e
3 changed files with 57 additions and 8 deletions
+8 -3
View File
@@ -150,7 +150,7 @@ class MapModuleDataProvider
*/
public function getOrganizationTags(array $selectedTagIds = []): array
{
if (!$this->tableExists('tl_tags')) {
if (!$this->tableExists('tl_tags') || !$this->tableExists('tl_tags_rel')) {
return [];
}
@@ -168,8 +168,13 @@ class MapModuleDataProvider
$qb = $this->connection->createQueryBuilder();
$qb
->select('t.id', sprintf('t.%s AS label', $labelColumn))
->from('tl_tags', 't')
->select('DISTINCT t.id', sprintf('t.%s AS label', $labelColumn))
->from('tl_tags_rel', 'r')
->innerJoin('r', 'tl_tags', 't', 't.id = r.tag_id')
->andWhere('r.ptable = :organization_ptable')
->andWhere('(r.field = :organization_field OR r.field IS NULL OR r.field = \'\')')
->setParameter('organization_ptable', 'tl_organization')
->setParameter('organization_field', 'tags')
->orderBy(sprintf('t.%s', $labelColumn), 'ASC');
if ([] !== $selectedTagIds) {