panelURL not outputing Panel URL

Hello everyone,

I just upgraded an intranet system from Kirby 2 to Kirby 4, while upgrade worked fine I’m having the issue of outputing the panel URL.

The code looks like this:

     <?php $filetransit = $block->cardProccessFile()->toPages(',')->sortBy('title', 'asc');
      foreach ($filetransit as $file) : ?>
        <?php if ($fileSingle = $file->documentSelect()->toFile()) : ?>
            <?php if ($user = $kirby->user() and $user->hasRole('admin')) : ?>
            <a href="<?= $file->panelUrl() ?>" target="_blank">
            bearbeiten
            </a>
            <?php endif; ?>
        <a href="<?= $fileSingle->url() ?>" alt="" class="btn--go">
        Verfahrensbeschreibung herunterladen</a>
        <?php endif ?>
     <?php endforeach ?>

Now when user is logged in as admin it had an additional option to open the corresponding page of $file directly in panel, but the $file-panelUrl() is outputting only the current page in frontend visitor is seeing and not the corresponding panel page. Do you have any idea where I made a mistake?

Try <?= $file->panel()->url()?>

1 Like

Perfect! Thanks!