Skip to content

Commit

Permalink
Fixed crashes with pre-filtered lists
Browse files Browse the repository at this point in the history
  • Loading branch information
hschottm committed Nov 19, 2024
1 parent 8bd3b59 commit c75bab8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
22 changes: 9 additions & 13 deletions src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,21 @@
$GLOBALS['TL_CTE']['texts']['headline'] = Hschottm\TagsBundle\ContentHeadlineTags::class;
$GLOBALS['TL_CTE']['media']['gallery'] = Hschottm\TagsBundle\ContentGalleryTags::class;

// previously css and js have been added only to the backend
/*
if (System::getContainer()->get('contao.routing.scope_matcher')
->isBackendRequest(System::getContainer()->get('request_stack')->getCurrentRequest() ?? Request::create(''))
)
{
}
*/

/**
* CSS files
*/
/**
* CSS files
*/

$GLOBALS['TL_CSS'][] = 'bundles/hschottmtags/css/tag.css';
$GLOBALS['TL_CSS'][] = 'bundles/hschottmtags/css/tag.css';

/**
* JavaScript files
*/
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/hschottmtags/js/tag.js';
/**
* JavaScript files
*/
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/hschottmtags/js/tag.js';
}

/**
* Hooks
Expand Down
5 changes: 2 additions & 3 deletions src/Resources/contao/elements/ContentGalleryTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ protected function getFilterTags()
$tags = preg_split("/,/", $this->tag_filter);
$placeholders = array();
foreach ($tags as $tag) {
\array_push($placeholders, '?');
\array_push($placeholders, "'" . $tag . "'");
}
\array_push($tags, 'tl_files');
return Database::getInstance()->prepare("SELECT tid FROM tl_tag WHERE tag IN (" . implode(',', $placeholders) . ") AND from_table = ? ORDER BY tag ASC")
->execute($tags)
->execute('tl_files')
->fetchEach('tid');
} else {
return array();
Expand Down
5 changes: 2 additions & 3 deletions src/Resources/contao/modules/ModuleCalendarTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ protected function getFilterTags()
$placeholders = array();
foreach ($tags as $tag)
{
\array_push($placeholders, '?');
\array_push($placeholders, "'" . $tag . "'");
}
\array_push($tags, 'tl_calendar_events');
return Database::getInstance()->prepare("SELECT tid FROM tl_tag WHERE tag IN (" . implode(',', $placeholders) . ") AND from_table = ? ORDER BY tag ASC")
->execute($tags)
->execute('tl_calendar_events')
->fetchEach('tid');
}
else
Expand Down
5 changes: 2 additions & 3 deletions src/Resources/contao/modules/ModuleNewsArchiveTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ protected function getFilterTags()
$placeholders = array();
foreach ($tags as $tag)
{
\array_push($placeholders, '?');
\array_push($placeholders, "'" . $tag . "'");
}
\array_push($tags, 'tl_news');
return Database::getInstance()->prepare("SELECT tid FROM tl_tag WHERE tag IN (" . implode(',', $placeholders) . ") AND from_table = ? ORDER BY tag ASC")
->execute($tags)
->execute('tl_news')
->fetchEach('tid');
}
else
Expand Down
5 changes: 2 additions & 3 deletions src/Resources/contao/modules/ModuleNewsListTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ protected function getFilterTags()
$placeholders = array();
foreach ($tags as $tag)
{
\array_push($placeholders, '?');
\array_push($placeholders, "'" . $tag . "'");
}
\array_push($tags, 'tl_news');
return Database::getInstance()->prepare("SELECT tid FROM tl_tag WHERE tag IN (" . implode(',', $placeholders) . ") AND from_table = ? ORDER BY tag ASC")
->execute($tags)
->execute('tl_news')
->fetchEach('tid');
}
else
Expand Down

0 comments on commit c75bab8

Please sign in to comment.