It is currently not possible to change the sidebar, main or add a new admin page to the panel.
Admin panel page workaround
It is possible to add an admin panel page like the image below by using a panel field.
- Create a page in the panel
- Add a blueprint for it
- Add a field with your tool (or what it might bee)
- Hide stuff with CSS if needed
Blueprint
<?php if(!defined('KIRBY')) exit ?>
title: Home
pages: false
files: false
fields:
title:
label: Title
type: text
page:
label: My cute pie chart
type: page
Field
My field is placed in /site/fields/page/page.php
.
<?php
class PageField extends BaseField {
public function __construct() {
$this->type = 'page';
}
public function content() {
ob_start();
?>
<div class="structure-entry">
<div class="structure-entry-content">
<p>About pie charts</p><br>
<img src="https://pixabay.com/static/uploads/photo/2012/04/16/12/26/chart-35773_640.png" style="max-width: 300px; width: auto; height: auto;">
</div>
</div>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
}
Hide title field and submit button
If you want, you can hide the submit button and the title field with CSS. I did not make a CSS for this proof of concept but it’s possible (I used Chrome Developer Tool to remove stuff).
Pitfalls
This is not the native way of doing things, but it’s the only solution at the moment without hacking the core.
Hidden fields are not gone
Even if you hide the title field and the submit button they are still there, just hidden. Because the title is required, that might be an issue as well, I have not tried all cases.
Page as container
You need a page to contain the field. You might need to route it on the frontend to an error page, as it is probably not used for the frontend as all.
$_POST don’t work
I could not get $_POST to work which makes it not so flexible. Use it for presentation not administration.
You can still add fields below your tool (or whatever it might be) or on another page and then pick them up.
Inspired by @flokosiol
I got this idea when I looked at a this plugin:
It’s possible to use that field space for some kind of presentation, not just form fields.
Update - Quick and dirty
You should not use the proof of concept code. It’s just to show the idea. It’s quick and dirty, not ment for use. Look at the code by @flokosiol below if you don’t already know about brick or tpl::load. That’s the Kirby way and the correct way of doing it. You should probably avoid inline CSS as well.