You are here

function panels_renderer_ipe::ajax_change_layout in Panels 7.3

AJAX entry point to create the controller form for an IPE.

1 call to panels_renderer_ipe::ajax_change_layout()
panels_renderer_ipe::ajax_set_layout in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php

File

panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php, line 387

Class

panels_renderer_ipe
Renderer class for all In-Place Editor (IPE) behavior.

Code

function ajax_change_layout($break = NULL) {
  if ($this
    ->ipe_test_lock('change_layout', $break)) {
    return;
  }

  // At this point, we want to save the cache to ensure that we have a lock.
  $this->cache->ipe_locked = TRUE;
  panels_edit_cache_set($this->cache);
  ctools_include('plugins', 'panels');
  ctools_include('common', 'panels');

  // @todo figure out a solution for this, it's critical
  if (isset($this->display->allowed_layouts)) {
    $layouts = $this->display->allowed_layouts;
  }
  else {
    $layouts = panels_common_get_allowed_layouts('panels_page');
  }

  // Filter out builders.
  $layouts = array_filter($layouts, '_panels_builder_filter');

  // Let other modules filter the layouts.
  drupal_alter('panels_layouts_available', $layouts);

  // Define the current layout.
  $current_layout = $this->plugins['layout']['name'];
  $output = panels_common_print_layout_links($layouts, $this
    ->get_url('set_layout'), array(
    'attributes' => array(
      'class' => array(
        'use-ajax',
      ),
    ),
  ), $current_layout);
  $this->commands[] = ctools_modal_command_display(t('Change layout'), $output);
  $this->commands[] = array(
    'command' => 'IPEsetLockState',
    'key' => $this->clean_key,
    'lockPath' => url($this
      ->get_url('unlock_ipe')),
  );
}