You are here

function ctools_context_handler_edit_context in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 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 and 301 response codes.

File

includes/context-task-handler.inc, line 376
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="clear-block"><div class="right-container">',
    '#suffix' => '</div>',
  );
  $form['left'] = array(
    '#prefix' => '<div class="left-container">',
    '#suffix' => '</div></div>',
  );
  $module = 'page_manager-' . $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);

  // Set an additional description if CCK and Token are enabled, to notify of unlisted keywords
  if (module_exists('content') && module_exists('token')) {
    $description = t('Note that CCK fields may be used as keywords using patterns like <em>%node:field_name-formatted</em>.');
  }
  elseif (!module_exists('token')) {
    $description = t('More keywords will be available if you install the Token module, see http://drupal.org/project/token.');
  }
  $form['left']['summary'] = array(
    '#prefix' => '<div class="page-manager-contexts">',
    '#suffix' => '</div>',
    '#value' => theme('ctools_context_list', $cache, t('Summary of contexts'), $description),
  );
  $form_state['context_object'] =& $cache;
}