function ctools_context_add_argument_form

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

File

includes/context-admin.inc, line 87

Code

function ctools_context_add_argument_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-arguments-table">',
        '#suffix' => '</div>',
        '#theme' => 'ctools_context_item_form',
        '#cache_key' => $cache_key,
        '#ctools_context_type' => 'argument',
        '#ctools_context_module' => $module,
    );
    $args = ctools_get_arguments();
    $choices = array();
    foreach ($args as $name => $arg) {
        if (empty($arg['no ui'])) {
            $choices[$name] = $arg['title'];
        }
    }
    asort($choices);
    if (!empty($choices) || !empty($object->arguments)) {
        ctools_context_add_item_table('argument', $form_location, $choices, $object->arguments);
    }
}