$tree error on frontpage

Hi,
I was editing my sons pages yesterday ( optag.nu ) and I changed a tree nav.
Now the pages get this error, and I have no idea what to do (?!?!?) :

Whoops \ Exception \ ErrorException (E_WARNING)
Undefined variable $tree

/customers/9/1/2/optag.nu/httpd.www/packages/modena/blocks/topic_list/templates/modena_filters/view.php

<?php  defined('C5_EXECUTE') or die("Access Denied.");
if (!isset($selectedTopicID)) {
    $selectedTopicID = null;
}
use Concrete\Core\Tree\Node\Node as TreeNode;
use Concrete\Core\Tree;
$pk = Package::getByHandle('modena');
?>
 
<div class="ccm-block-topic-list-flat-filter margin-bottom-20">
<?php if($tree) : ?>
<?php
    if (is_object($tree)) {
        $node = $tree->getRootTreeNodeObject();
        if (is_object($node)) {
            $node->populateDirectChildrenOnly(); ?>
 
                <div class="isotope-filters-buttons <?php echo $pk->getConfig()->get('vidal.ensemble.topic_list_position','text-center'); ?>">
                    <div class="isotope-filters-button
                    <?php if (!$selectedTopicID) { ?> isotope-filters-button__selected"<?php } ?>><?php echo t('All')?></div><span class="isotope-filters-divider">/</span>
 
                <?php foreach ($node->getChildNodes() as $child) { ?>
 
                <?php
                    $topics = $child->getTreeNodeDisplayName();
                    $tax_links = str_replace(' ', '-', $topics );
                    $tax = strtolower($tax_links);
                ?>
 
                <div class="isotope-filters-button" data-filter=".<?php echo $tax;  ?>"
                    <?php if (isset($selectedTopicID) && $selectedTopicID == $child->getTreeNodeID()) { ?>
                        class="isotope-filters-button__selected"
                    <?php } ?> ><?php echo $child->getTreeNodeDisplayName()?></div><span class="isotope-filters-divider">/</span>
                <?php } ?>
            </div>
        <?php } ?>
    </div>
<?php } ?>
                    <?php endif; ?>

Arguments

  1. “Undefined variable $tree”

Concrete CMS

Version “9.3.7”
Installed Version “9.3.7”
Database Version “20240910000000”

PHP

Version “8.2.27”
Extensions array:52

I believe if you change this line

to

that should fix it. Tree is not always defined it would seem, so you’re referencing an undefined variable.

You may need to update Modena.