You are here

onecol.inc in Panels 5.2

File

layouts/onecol.inc
View source
<?php

/**
 * implementation of hook_panels_layouts
 */
function panels_onecol_panels_layouts() {
  $items['onecol'] = array(
    'title' => t('Single column'),
    'icon' => 'layouts/onecol.png',
    'theme' => 'panels_onecol',
    'css' => 'layouts/onecol.css',
    'panels' => array(
      'middle' => t('Middle column'),
    ),
    'settings form' => 'panels_onecol_settings',
  );
  return $items;
}
function panels_onecol_settings($display, $layout, $settings) {
  $form['plain'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use minimalistic (plain) output'),
    '#default_value' => isset($settings['plain']) ? $settings['plain'] : 0,
    '#description' => t('Enable this option to output minimal panels display HTML markup.'),
  );
  return $form;
}

/**
 * This function uses heredoc notation to make it easier to convert
 * to a template.
 */
function theme_panels_onecol($id, $content, $settings) {
  if ($id) {
    $idstr = " id='{$id}'";
  }
  if (!empty($settings['plain'])) {
    $output = <<<EOT
<div class="panel-display"{<span class="php-variable">$idstr</span>}>{<span class="php-variable">$content</span>[<span class="php-string">'middle'</span>]}</div>
EOT;
  }
  else {
    $output = <<<EOT
<div class="panel-display panel-1col clear-block"{<span class="php-variable">$idstr</span>}>
  <div class="panel-panel panel-col">
    <div>{<span class="php-variable">$content</span>[<span class="php-string">'middle'</span>]}</div>
  </div>
</div>
EOT;
  }
  return $output;
}

Functions

Namesort descending Description
panels_onecol_panels_layouts implementation of hook_panels_layouts
panels_onecol_settings
theme_panels_onecol This function uses heredoc notation to make it easier to convert to a template.