This is a tutorial on how to create Panels layout and style plugins.
Panels/CTools provides a way for developers to add style and layout plugins within other modules, granting enormous flexibility.
The Panels Plugin Example is exclusively for developers. It provides example code to try to get a developer off the ground quickly in creating a plugin. Extensively documented code means that you can just fiddle with it and get it to do what you want it to do.
In addition to the code, there is a panel demonstrating the style and layout plugins.
The module providing Panels plugins needs to implement hook_ctools_plugin_directory() to tell Panels/CTools that it's providing plugins and where they are.
function panels_plugin_example_ctools_plugin_directory($module, $plugin) {
if ($module == 'panels' && !empty($plugin)) {
return "plugins/$plugin";
}
}
Just change "panels_plugin_example" to the shortname of your module.
Style plugins provide a way to theme or render the content of an entire panel, a region, or an individual pane. In this example, the theming just changes the text color with a style attribute.
To create a style plugin,
The <pluginname>.inc file must implement hook_panels_styles(). The color_example.inc in the example gives complete instructions about function naming and you can use it as an example.
To create a layout plugin,
The <pluginname>.inc file simply implements hook_panels_layouts(), which provides a set of instructions on how the plugin is implemented.
The twocol_example.inc file in the example gives exact instructions on how naming works and how to set up the hook_panels_layouts() function.
More information on the layout plugins is available in the Panels advanced help on layout plugins.You may be interested in two excellent tutorials on this subject: