You are here

function panels_bootstrap_render_item in Panels Bootstrap Layout Builder 7

Same name and namespace in other branches
  1. 7.3 plugins/layouts/bootstrap/bootstrap.inc \panels_bootstrap_render_item()

Render a column in the bootstrap layout.

3 calls to panels_bootstrap_render_item()
panels_ajax_bootstrap_edit_add in plugins/layouts/bootstrap/bootstrap.inc
AJAX responder to add a new row, column or region to a bootstrap layout.
panels_bootstrap_render_items in plugins/layouts/bootstrap/bootstrap.inc
Render a piece of a bootstrap layout.
theme_panels_bootstrap_admin in plugins/layouts/bootstrap/bootstrap.inc
Draw the bootstrap layout.

File

plugins/layouts/bootstrap/bootstrap.inc, line 484

Code

function panels_bootstrap_render_item($renderer, $item, $content, $id, $position, $max, $clear = FALSE) {
  $base = $renderer->item_class[$item['type']];
  $output = '';
  $item_class = '';
  $bootstrap_class = '';
  if (isset($item['class'])) {
    $item_class = check_plain($item['class']);
  }
  if (($item['type'] == 'region' || $item['type'] == 'column') && isset($item['bootstrap_class'])) {
    $bootstrap_class = $item['bootstrap_class'];
  }
  else {
    if ($item['type'] == 'region' || $item['type'] == 'column') {
      $bootstrap_class = 'span1';
    }
  }
  $item_type = $item['type'];
  if ($item['type'] == "row") {
    if (isset($item['grid_type'])) {
      $grid_type = $item['grid_type'];
    }
    else {
      $grid_type = 'row';
    }
  }
  $output .= '  <div id="panel-bootstrap-' . $item['type'] . '-' . $id . '" class="' . $bootstrap_class . ' ' . $item_class . ' ' . $grid_type . ' inside';
  if ($position == 0) {
    $output .= ' ' . $item['type'] . '-inside-first';
  }
  if ($position == $max) {
    $output .= ' ' . $item['type'] . '-inside-last';
  }
  if ($clear) {
    $output .= ' clearfix';
  }
  $output .= "\">\n";
  if (!empty($renderer->admin)) {
    $output .= panels_bootstrap_render_item_links($renderer, $id, $item);
    if ($item['type'] == 'region' || $item['type'] == 'column') {
      $output .= '<div class="bootstrap-class-selector clearfix" >';
      $output .= panels_bootstrap_render_bootstrap_class_selector($renderer, $id);
      $output .= '</div>';
    }
  }
  $output .= $content;
  $output .= '  </div>' . "\n";
  return $output;
}