You are here

function ctools_context_add_item_table in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/context-admin.inc \ctools_context_add_item_table()

Add the context table to the page.

4 calls to ctools_context_add_item_table()
ctools_context_add_argument_form in includes/context-admin.inc
Add the argument table plus gadget plus javascript to the form.
ctools_context_add_context_form in includes/context-admin.inc
ctools_context_add_relationship_form in includes/context-admin.inc
ctools_context_add_required_context_form in includes/context-admin.inc

File

includes/context-admin.inc, line 224
includes/common-context.inc Provide API for adding contexts for modules that embed displays.

Code

function ctools_context_add_item_table($type, &$form, $available_contexts, $items) {
  $form[$type] = array(
    '#tree' => TRUE,
  );
  $module = $form['#ctools_context_module'];
  $cache_key = $form['#cache_key'];
  if (isset($items) && is_array($items)) {
    foreach ($items as $position => $context) {
      ctools_context_add_item_to_form($module, $type, $cache_key, $form[$type][$position], $position, $context);
    }
  }
  $type_info = ctools_context_info($type);
  $form['description'] = array(
    '#prefix' => '<div class="description">',
    '#suffix' => '</div>',
    '#markup' => $type_info['description'],
  );
  ctools_context_add_item_table_buttons($type, $module, $form, $available_contexts);
}