Created
March 9, 2015 10:54
-
-
Save bastianallgeier/c34a99c54fa849f3adb0 to your computer and use it in GitHub Desktop.
Most basic widget setup for panel widgets. You would put those two files in /site/widgets/mywidget/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'title' => 'Widget Title', | |
'html' => function() { | |
// any data for the template | |
$data = array(); | |
return tpl::load(__DIR__ . DS . 'template.php', $data); | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- html for the widget --> |
Hey,
Is there a way to access $site or $page within the template?
@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!)
I'd love to put widgets in the sidebar of the page/content editor...
I second this ^
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Like where this is heading.