You are here

function panels_flexible_render_item in Panels 7.3

Same name and namespace in other branches
  1. 6.3 plugins/layouts/flexible/flexible.inc \panels_flexible_render_item()

Render a column in the flexible layout.

3 calls to panels_flexible_render_item()
panels_ajax_flexible_edit_add in plugins/layouts/flexible/flexible.inc
AJAX responder to add a new row, column or region to a flexible layout.
panels_flexible_render_items in plugins/layouts/flexible/flexible.inc
Render a piece of a flexible layout.
theme_panels_flexible_admin in plugins/layouts/flexible/flexible.inc
Draw the flexible layout.

File

plugins/layouts/flexible/flexible.inc, line 538
Flexible layout plugin.

Code

function panels_flexible_render_item($renderer, $item, $content, $id, $position, $max, $clear = FALSE) {

  // If we are rendering a row and there is just one row, we don't need to
  // render the row unless there is fixed_width content inside it.
  if (empty($renderer->admin) && $item['type'] == 'row' && $max == 0) {
    $fixed = FALSE;
    foreach ($item['children'] as $id) {
      if ($renderer->settings['items'][$id]['width_type'] != '%') {
        $fixed = TRUE;
        break;
      }
    }
    if (!$fixed) {
      return $content;
    }
  }

  // If we are rendering a column and there is just one column, we don't
  // need to render the column unless it has a fixed_width.
  if (empty($renderer->admin) && $item['type'] == 'column' && $max == 0 && $item['width_type'] == '%') {
    return $content;
  }
  $base = $renderer->item_class[$item['type']];
  $output = '<div class="' . $base . ' ' . $renderer->base[$item['type']] . '-' . $id;
  if ($position == 0) {
    $output .= ' ' . $base . '-first';
  }
  if ($position == $max) {
    $output .= ' ' . $base . '-last';
  }
  if ($clear) {
    $output .= ' clearfix';
  }
  if (isset($item['class'])) {
    $output .= ' ' . check_plain($item['class']);
  }
  $output .= '">' . "\n";
  if (!empty($renderer->admin)) {
    $output .= panels_flexible_render_item_links($renderer, $id, $item);
  }
  $output .= '  <div class="inside ' . $base . '-inside ' . $base . '-' . $renderer->base_class . '-' . $id . '-inside';
  if ($position == 0) {
    $output .= ' ' . $base . '-inside-first';
  }
  if ($position == $max) {
    $output .= ' ' . $base . '-inside-last';
  }
  if ($clear) {
    $output .= ' clearfix';
  }
  $output .= "\">\n";
  $output .= $content;
  $output .= '  </div>' . "\n";
  $output .= '</div>' . "\n";
  return $output;
}