You are here

function ctools_context_handler_edit_context in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/context-task-handler.inc \ctools_context_handler_edit_context()

Edit contexts that go with this panel.

1 string reference to 'ctools_context_handler_edit_context'
http_response.inc in page_manager/plugins/task_handlers/http_response.inc
This is the task handler plugin to handle generating 403, 404, 301 and 302 response codes.

File

includes/context-task-handler.inc, line 496
Support for creating 'context' type task handlers.

Code

function ctools_context_handler_edit_context($form, &$form_state) {
  ctools_include('context-admin');
  ctools_context_admin_includes();
  $handler = $form_state['handler'];
  $page = $form_state['page'];
  $cache_name = $handler->name ? $handler->name : 'temp';
  if (isset($page->context_cache[$cache_name])) {
    $cache = $page->context_cache[$cache_name];
  }
  else {
    $cache = ctools_context_handler_get_task_object($form_state['task'], $form_state['subtask'], $form_state['handler']);
    $form_state['page']->context_cache[$cache_name] = $cache;
  }
  $form['right'] = array(
    '#prefix' => '<div class="clearfix"><div class="right-container">',
    '#suffix' => '</div>',
  );
  $form['left'] = array(
    '#prefix' => '<div class="left-container">',
    '#suffix' => '</div></div>',
  );
  $module = 'page_manager_context::' . $page->task_name;
  ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $cache);
  ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $cache);
  $theme_vars = array();
  $theme_vars['object'] = $cache;
  $theme_vars['header'] = t('Summary of contexts');
  $form['left']['summary'] = array(
    '#prefix' => '<div class="page-manager-contexts">',
    '#suffix' => '</div>',
    '#markup' => theme('ctools_context_list', $theme_vars),
  );
  $form_state['context_object'] =& $cache;
  return $form;
}