You are here

function panels_flexible_render_splitter in Panels 6.3

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

Render a splitter div to place between the $left and $right items.

If the right ID is NULL that means there isn't actually a box to the right, but we need a splitter anyway. We'll mostly use info about the left, but pretend it's 'fluid' so that the javascript won't actually modify the right item.

3 calls to panels_flexible_render_splitter()
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_ajax_flexible_edit_remove in plugins/layouts/flexible/flexible.inc
AJAX responder to remove an existing row, column or region from a flexible layout.
panels_flexible_render_items in plugins/layouts/flexible/flexible.inc
Render a piece of a flexible layout.

File

plugins/layouts/flexible/flexible.inc, line 569

Code

function panels_flexible_render_splitter($renderer, $left_id, $right_id) {
  $left = $renderer->settings['items'][$left_id];
  $left_class = $renderer->base[$left['type']] . '-' . $left_id;
  if ($right_id) {
    $right = $renderer->settings['items'][$right_id];
    $right_class = $renderer->base[$left['type']] . '-' . $right_id;
  }
  else {
    $right = $left;
    $right_class = $left_class;
  }
  $output = '<div class="panels-flexible-splitter flexible-splitter-for-' . $left_class . '">';

  // Name the left object
  $output .= '<span class="panels-flexible-splitter-left">';
  $output .= '.' . $left_class;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-left-id">';
  $output .= $left_id;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-left-width ' . $left_class . '-width">';
  $output .= $left['width'];
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-left-scale">';
  $output .= isset($renderer->scale[$left_id]) ? $renderer->scale[$left_id] : 1;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-left-width-type">';
  $output .= $left['width_type'];
  $output .= '</span>';

  // Name the right object
  $output .= '<span class="panels-flexible-splitter-right">';
  $output .= '.' . $right_class;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-right-id">';
  $output .= $right_id;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-right-width ' . $right_class . '-width">';
  $output .= $right['width'];
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-right-scale">';
  $output .= isset($renderer->scale[$right_id]) ? $renderer->scale[$right_id] : 1;
  $output .= '</span>';
  $output .= '<span class="panels-flexible-splitter-right-width-type">';

  // If there is no right, make it fluid.
  $output .= $right_id ? $right['width_type'] : '%';
  $output .= '</span>';
  $output .= '</div>';
  return $output;
}