Skip to content

Instantly share code, notes, and snippets.

Created March 9, 2015 10:54
What would you like to do?
Most basic widget setup for panel widgets. You would put those two files in /site/widgets/mywidget/
return array(
'title' => 'Widget Title',
'html' => function() {
// any data for the template
$data = array();
return tpl::load(__DIR__ . DS . 'template.php', $data);
<!-- html for the widget -->
Copy link

boycce commented Mar 22, 2015

Like where this is heading.

Copy link


Is there a way to access $site or $page within the template?

Copy link

@eytanbiala You ought to be able to use the omnipresent page() and site() functions to return the active Page or Site objects… Although, I'm not sure what is to be expected from page(), given that we're not really in a standard Kirby front-end context.

(I haven't tried this!)

Copy link

I'd love to put widgets in the sidebar of the page/content editor...

Copy link

I second this ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment