You are here

function ctools_context_add_argument_form in Chaos Tool Suite (ctools) 6

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

Add the argument table plus gadget plus javascript to the form.

File

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

Code

function ctools_context_add_argument_form($module, &$form, &$form_state, &$form_location, $object, $name = NULL) {
  if (empty($name)) {
    $name = $object->name;
  }
  $form_location = array(
    '#prefix' => '<div id="ctools-arguments-table">',
    '#suffix' => '</div>',
    '#theme' => 'ctools_context_item_form',
    '#object_name' => $name,
    '#ctools_context_type' => 'argument',
    '#ctools_context_module' => $module,
  );
  $args = ctools_get_arguments();
  $choices = array();
  foreach ($args as $name => $arg) {
    $choices[$name] = $arg['title'];
  }
  asort($choices);
  if (!empty($choices) || !empty($object->arguments)) {
    ctools_context_add_item_table('argument', $form_location, $choices, $object->arguments);
  }
}