You are here

function panels_flexible_panels in Panels 6.2

Same name and namespace in other branches
  1. 5.2 layouts/flexible.inc \panels_flexible_panels()
  2. 6.3 plugins/layouts/flexible/flexible.inc \panels_flexible_panels()
  3. 7.3 plugins/layouts/flexible/flexible.inc \panels_flexible_panels()

Define the actual list of columns and rows for this flexible panel.

1 string reference to 'panels_flexible_panels'
panels_flexible_panels_layouts in layouts/flexible/flexible.inc
Implementation of hook_panels_layouts()

File

layouts/flexible/flexible.inc, line 259

Code

function panels_flexible_panels($display, $settings) {
  $panels = array();
  if (empty($settings)) {
    $settings = panels_flexible_default_panels();
  }
  if (!empty($settings['sidebars']['left'])) {
    $panels['sidebar_left'] = t('Left sidebar');
  }
  if (!empty($settings['sidebars']['right'])) {
    $panels['sidebar_right'] = t('Right sidebar');
  }
  for ($row = 1; $row <= intval($settings['rows']); $row++) {
    for ($col = 1; $col <= intval($settings["row_{$row}"]['columns']); $col++) {
      if (!empty($settings["row_{$row}"]['names'][$col - 1])) {
        $panels["row_{$row}_{$col}"] = $settings["row_{$row}"]['names'][$col - 1];
      }
      else {
        $panels["row_{$row}_{$col}"] = t("Row @row, Column @col", array(
          '@row' => $row,
          '@col' => $col,
        ));
      }
    }
  }
  return $panels;
}