I'm pretty sure documentation exists on this: a step by step process to add a new custom layout into panels.

If not, here,s my specific question:

I'm trying to add a new layout so, since I'm pretty new to Drupal I just copied the two columns stacked layout and changed the variables and CSS names to something new, so I can start from somewhere - I also made a new .png.

But I can't have my new layout appear in the select list on my site - what else do I need to do for the module to "see" the new layout (or is my code wrong?)

here's the CSS

/* $Id: company.css,v Beta 2008/01/25 20:16:53 lordcrap Exp $ */

.company1 { 
  /* border: 1px solid red; */ 
  overflow: hidden; 
}

.company1 > div {
  margin: .5px;
}

.company1 .company1-top,
.company1 .company1-bottom {
  width: 99.9%;
  clear: both;
}
.company1 .company1-first {
  float: left;
  width: 47%;
}
.company1 .company1-last {
  float: right;
  width: 47%;
}
.company1-panel-clearer {
  clear: both;
}

Here's the INC

<?php
// $Id: company.inc,v Beta 2008/01/25 23:54:20 lordcrap Exp $

/**
 * implementation of hook_panels_layouts
 */
function panels_company_profile1() {
  $items['company1'] = array(
    'module' => 'panels',
    'title' => t('Company Profile'),
    'icon' => 'layouts/company.png',
    'theme' => 'panels_company_profile1',
    'css' => 'layouts/company.css',
    'content areas' => array('top' => t('Top'), 'left' => t('Left side'), 'right' => t('Right side'), 'bottom' => t('Bottom')),
  );

  return $items;
}

/**
 * This function uses heredoc notation to make it easier to convert
 * to a template.
 */
function theme_panels_company_profile1($id, $content) {
  if ($id) {
    $idstr = " id='$id'";
  }

  $output = <<<EOT
<div class="company1" $idstr>
  <div class="company1-top">
    <div>$content[top]</div>
  </div>
  <div class="company1-first">
    <div>$content[left]</div>
  </div>

  <div class="company1-last">
    <div>$content[right]</div>
  </div>
  <div class="company1-bottom">
    <div>$content[bottom]</div>
  </div>
</div>
<br class="company1-panel-clearer" />
EOT;
  return $output;
}

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

When creating custom layouts, you should not create a .inc file.

Instead, you should create a module and implement hook_panels_layouts().

I would say from the above that the .inc file doesn't work because your layouts hook is named incorrectly.

LordCrap’s picture

Status: Closed (won't fix) » Closed (fixed)

Thanks! I'll try that.