In the transition from Drupal 6 to 7 there have been a few changes in how one should be creating custom layouts for panels. This guide will go over the changes to move your panel layouts into the Drupal 7 space.
Drupal 6 Panels Layout:
your_module.module:
/*
* Implementation of hook_ctools_plugin_directory().
*/
function your_module_ctools_plugin_directory($module, $plugin) {
if ($module == 'ctools' || $module == 'panels') {
return 'plugins/' . $plugin;
}
}
plugins/layouts/row_16_row_4_12/row_16_row_4_12.inc:
$plugin = array(
'title' => t('Row 16 / Row 4, 12'),
'icon' => 'row_16_row_4_12.png',
'theme' => 'row_16_row_4_12',
'category' => t('Ninesixty'),
'panels' => array(
'row_1_16' => t('Row 1 - 16 Columns'),
'row_2_4' => t('Row 2 - 4 Columns'),
'row_2_12' => t('Row 2 - 12 Columns'),
),
);
plugins/layouts/row_16_row_4_12/row-16-row-4-12.tpl.php:
<div id="row-16-row-4-12"><div id="row-1-16"><?php print $row_1_16; ?></div><div id="row-2-4"><?php print $row_2_4; ?></div><div id="row-2-12"><?php print $row_2_12; ?></div></div>
Drupal 7 Panels Layout:
your_module.module:
/*
* Implementation of hook_ctools_plugin_directory().
*/
function your_module_ctools_plugin_directory($module, $plugin) {
if ($module == 'ctools' || $module == 'panels') {
return 'plugins/' . $plugin;
}
}
plugins/layouts/row_16_row_4_12/row_16_row_4_12.inc:
$plugin = array(
'title' => t('Row 16 / Row 4, 12'),
'icon' => 'row_16_row_4_12.png',
'theme' => 'row_16_row_4_12',
'category' => t('Ninesixty'),
'regions' => array(
'row_1_16' => t('Row 1 - 16 Columns'),
'row_2_4' => t('Row 2 - 4 Columns'),
'row_2_12' => t('Row 2 - 12 Columns'),
),
);
plugins/layouts/row_16_row_4_12/row-16-row-4-12.tpl.php:
<div id="row-16-row-4-12">
<div id="row-1-16" class="grid-16 alpha omega">
<?php print $content['row_1_16']; ?>
</div>
<div id="row-2-4" class="grid-4 alpha">
<?php print $content['row_2_4']; ?>
</div>
<div id="row-2-12" class="grid-12 omega">
<?php print $content['row_2_12']; ?>
</div> </div>
You will notice 2 major differences. The first is in your .inc file. To define regions you would use the key ‘panels’ in Drupal 6. This has now changed to ‘regions’. The other major difference is in your tpl file. In Drupal 7 your content regions now all exist in the $content array.