Overriding panelUrl page method [bug?]

Hi everyone,

I have overridden the page method panelURL. Everything looks fine but the generated URL is only working doing a Right-click > Open Link in New Tab in the Panel. If I left-click it, panel homepage is loaded…

If someone has an idea of why…

Thanks!

Simple example to have the issue:

<?php
#/site/models/my.php

class MyPage extends Page {

  /**
   * Tweaks the panelUrl
   *
   *
   * @param page|null $context
   * @param array|string|null $options
   * @return string
   */
  public function panelUrl($options = null): string
  {
    // return the original panelUrl, so it should not change anything. But it is.
    return parent::panelUrl();
  }

}

Orignal context:

<?php
#/site/models/my.php

class MyPage extends Page {

  /**
   * Tweaks the panelUrl
   *
   * Redirect page panelUrl to the first image panelUrl if there is one.
   *
   * @param page|null $context
   * @param array|string|null $options
   * @return string
   */
  public function panelUrl($options = null): string
  {
    if (!parent::hasImages()) return parent::panelUrl();
    return parent::panelUrl() .'/'. parent::images()->first()->panelPath();
    // returning `parent::images()->first()->panelUrl()` seams to create an infinite loop…
  }

}

I get an error in the Panel as soon as I add that method, don’t you?

No errors for me with Kirby 3.1.0…