# Overriding panelUrl page method \[bug?\]

**URL:** <https://forum.getkirby.com/t/overriding-panelurl-page-method-bug/14489>\
**Category:** Questions\
**Tags:** v3\
**Created:** [June 4, 2019, 6:34pm UTC](https://forum.getkirby.com/t/overriding-panelurl-page-method-bug/14489 "2019-06-04T18:34:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 4, 2019, 6:34pm UTC](https://forum.getkirby.com/t/overriding-panelurl-page-method-bug/14489/1 "2019-06-04T18:34:27Z")

</div>

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
<?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
<?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…
  }

}

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 4, 2019, 7:28pm UTC](https://forum.getkirby.com/t/overriding-panelurl-page-method-bug/14489/2 "2019-06-04T19:28:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![julieng](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/julieng/32/6770_2.png) [@julieng](https://forum.getkirby.com/u/julieng)\
**Post date:** [June 5, 2019, 9:40am UTC](https://forum.getkirby.com/t/overriding-panelurl-page-method-bug/14489/3 "2019-06-05T09:40:10Z")

</div>

No errors for me with Kirby 3.1.0…
