You are here

function panels_panel_context_edit_content in Panels 7.3

Same name and namespace in other branches
  1. 6.3 plugins/task_handlers/panel_context.inc \panels_panel_context_edit_content()

Present the panels drag & drop editor to edit the display attached to the task handler.

1 string reference to 'panels_panel_context_edit_content'
panel_context.inc in plugins/task_handlers/panel_context.inc
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

File

plugins/task_handlers/panel_context.inc, line 705
This is the task handler plugin to handle attaching a panel to any task that advertises itself as a 'context' type, which all of the basic page tasks provided by page_manager.module do by default.

Code

function panels_panel_context_edit_content($form, &$form_state) {
  ctools_include('ajax');
  ctools_include('plugins', 'panels');
  ctools_include('common', 'panels');
  ctools_include('context');
  ctools_include('context-task-handler');
  $cache = panels_edit_cache_get(panels_panel_context_cache_key($form_state['task_name'], $form_state['handler_id'], array()));
  $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
  $form_state['renderer']->cache =& $cache;
  $form_state['display'] =& $cache->display;
  $form_state['content_types'] = $cache->content_types;

  // Tell the Panels form not to display buttons.
  $form_state['no buttons'] = TRUE;
  $form_state['display_title'] = !empty($cache->display_title);
  $form_state['no preview'] = TRUE;
  $form_state['page']->display_cache[$form_state['handler_id']] = $cache;
  $form = panels_edit_display_form($form, $form_state);
  if (!isset($form_state['type']) || $form_state['type'] != 'add' && !empty($form_state['handler_id']) && !empty($form['buttons'])) {
    $form['buttons']['preview'] = $form['buttons']['return'];
    $form['buttons']['preview']['#value'] = t('Update and preview');
  }
  return $form;
}