TinyURL in the Panel

Hi there everyone! I have a small question and thought maybe somebody has tried something similar and wants to share their knowledge of the matter.

Is it possible to display the tinyurl of the edited page in the panel? Maybe as a protected field? I know $page->tinyurl() exists, but I need the value to be displayed on the panel and only for the editors of the page.

Thanks in advance for any tip.

You could probably create a custom field for that.
I recommend using @jenstornell’s boiler field:

Is that something you think you can do? Do you need further help?

1 Like

Another alternative could be:

With this plugin you don’t need to create a new field every time you need something simple for the panel.

This field calls for a snippet that you have set in your blueprint. That way you only need one field, the fragment field.

1 Like

@Thiousi and @jenstornell Thank you very much for your solutions. The last one (Kirby Fragment Field) seems to be exactly what I need. I’ll get to work =) !

Thank you very much, and kudos for the amazing and supportive community!


I’ve created a tiny field because I needed it :slight_smile:

Copy this code to site/fields/tinyurl/tinyurl.php

class TinyurlField extends BaseField{
	public function content() {
		$tinyurl = $this->page()->tinyurl();
		$html = brick('div')->append($tinyurl );
		return $html;

In your blueprint use it like this:

  label: Tinyurl
  type: tinyurl

Is this the tiniest Kirby field? :slight_smile:

Note: you could make it way nicer by:

  • using an input field as a base in read-only mode
  • add a link icon
  • add a copy to clipboard on click…

Edit: I went ahead and did the first two:

The code looks like that:

class TinyurlField extends TextField{
	public function __construct() {
		$this->type  = 'tinyurl';
    		$this->icon  = 'chain';
    		$this->readonly = true;
	public function input() {
		$input = parent::input();
		$input->data('field', 'tinyurl');
		$input->attr('value', $this->page->tinyurl());
    		return $input;

Dude, you rock! Thanks for sharing it.

1 Like

I improved the field a bit with click to copy to clipboard