You are here

function ctools_context_add_relationship_form in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/context-admin.inc \ctools_context_add_relationship_form()
2 calls to ctools_context_add_relationship_form()
ctools_access_ruleset_ui::edit_form_context in ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php
ctools_context_handler_edit_context in includes/context-task-handler.inc
Edit contexts that go with this panel.

File

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

Code

function ctools_context_add_relationship_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) {
  if (empty($cache_key)) {
    $cache_key = $object->name;
  }
  $form_location = array(
    '#prefix' => '<div id="ctools-relationships-table">',
    '#suffix' => '</div>',
    '#theme' => 'ctools_context_item_form',
    '#cache_key' => $cache_key,
    '#ctools_context_type' => 'relationship',
    '#ctools_context_module' => $module,
  );

  // Store the order the choices are in so javascript can manipulate it.
  $form_location['markup'] = array(
    '#value' => '&nbsp;',
  );
  $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array();
  $available_relationships = ctools_context_get_relevant_relationships(ctools_context_load_contexts($object, TRUE, $base_contexts));
  ctools_context_add_item_table('relationship', $form_location, $available_relationships, $object->relationships);
}