Skip to content

Commit

Permalink
Restore compatibility with Haste 4
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 27, 2024
1 parent e4aa106 commit 68518f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require": {
"php": "^8.0",
"contao/core-bundle": "^4.13 || ^5.0",
"codefog/contao-haste": "^5.0",
"codefog/contao-haste": "^4.21 || ^5.0",
"codefog/tags-bundle": "^3.3",
"doctrine/dbal": "^3.3",
"psr/log": "^1.0 || ^2.0 || ^3.0",
Expand Down
8 changes: 7 additions & 1 deletion src/EventListener/DataContainerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Contao\System;
use Contao\Validator;
use Doctrine\DBAL\Connection;
use Haste\Model\Model;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -182,7 +183,12 @@ public function onLabelCallback(array $row, string $label, DataContainer|null $d
}

$tags = [];
$tagIds = DcaRelationsModel::getRelatedValues('tl_node', 'tags', $row['id']);

if (\class_exists(DcaRelationsModel::class)) {
$tagIds = DcaRelationsModel::getRelatedValues('tl_node', 'tags', $row['id']);
} else {
$tagIds = Model::getRelatedValues('tl_node', 'tags', $row['id']);
}

// Generate the tags
if (\count($tagIds) > 0) {
Expand Down

0 comments on commit 68518f2

Please sign in to comment.