I did not add this into suggestions because this is not a core suggestion, but might be a good idea for a plugin.
Panel bar frontend
WordPress have a top bar with shortcuts to the admin. I think it could be nice for Kirby too, as a plugin.
This is my idea of what it could look like (look at the black thing), very basic so far…
Both “Edit page” and “Log out” are shortcuts to the panel, just plain links.
What do you think about a plugin like that?
Exclude / include stuff
I’m thinking of having basic stuff as default and with a config array exclude stuff that is not needed.
Good idea? Or would you want an array of including stuff instead?
Change panel bar
I think it needs to be customizable. The best way I can think of is by having a snippet with a snippet name configured in the config. That way anything can be added to the panel bar.
Now there is a left and a right side on the bar.
Should it be two snippets, one for each side or just one?
The main problem I see is that Kirby does not control the styling and layout of the page. It would definitely be required to manually embed the code snippet from the template by using a plugin function to keep it clean.
I’ve cobbled together a snippet a while ago, providing me with a deeplink to the corresponding panel-page; ideal for fixing typos etc.; styling via css as a fixed button in the lower right in my case; could be easily extended with additional links/functionalities such as logout and others.
@lukasbestle I could not deside if the snippet name should be in the config or in the function. When in the config the template looks cleaner, but when in the template it’s faster to change it when needed.
It will probably be better to have it in the config after all, just because it has to do with the backend.
@franzwalter I also have a snippet of this already running on my site. I prefer to have the full url in the href, just to be safe.
I also started on a plugin but I got stuck. I did not get far. You are probably much more skilled than me so you are welcome to continue.
Template
<?php echo panelbar::css(); ?>
It complains about that $site is undefined. The same thing with $page.
Plugin class
class panelbar {
public static function css() {
if( $site->user() ) {
$stylesheet = c::get('panelbar.stylesheet');
return $stylesheet;
}
}
protected function __construct() { }
private function __clone() { }
private function __wakeup() { }
}
My thoughts
To be able to control the content with inside the bar with a snippet. Controlling it with an array can be nice at first but sooner or later you might want to control it fully.
Set own name for the snippet. This to not collide with other files in the snippets.
Use the icons from the panel icon font when possible.
Use the same font as the panel. Just to make it feel like we are still in the panel.
Use singleton pattern like @lukasbestle wrote, it looks nice.
Prefix div classes to prevent collisions, like “pb-”.
That’s because $site and $page are in global scope and not in the method’s scope. You need to use site() and page(). BTW: Why are you passing $page to the method? You are not using the variable.
And also: The constructor and other magic methods must be public.
Opps, I forgot to remove $page before pasting this here. I just think it’s strange because tpl::load() work with $site and $page without needing to passing them to the method. My own don’t.
I even tried to duplicate tpl::load() function (copied Kirby core code) and just renamed it jens::load(), but the jens-version did not work. Same problem, undefined $site or $page. I guess it’s a dependence I have not taken into account.
To add my two cents to the discussion : While a page edit button makes sense for single pages like a blog articles etc., it is quite useless if pages are made up of different modules. I would therefore prefer edit buttons right where the content that needs to be edited is (like it is implemented in Joomla).