We now have a very simple plugin skeleton ready to go. All we need to do is add it to a panel, configure it (by adding HTML), and then show it on the front-end.
First, we need to show the list of available widgets.
Edit the file /ww.plugins/panels/admin/index.php
and change the widgets section to this:
// { widgets echo 'ww_widgets=['; $ws=array(); foreach($PLUGINS as $n=>$p){ if(isset($p['frontend']['widget']))$ws[]='{type:"'.$n .'",description:"'.addslashes($p['description']).'"}'; } echo join(',',$ws); echo '];'; // }
That will output the following to our browser:
ww_widgets=[{type:"content-snippet",description:"Add small static HTML snippets to any panel - address, slogan, footer, image, etc."}];
Now we edit the admin/js.js
file to show these widgets in the left-hand side column. This will involve a few small changes, so we'll step through them one at a time.
First, add the highlighted lines to the $(function){
section:
panels_init(panel_column)...