How to pass argument in ctools_modal_form_wrapper? A very strange issue come across while using ctools_modal_form_wrapper and ctools-use-modal. I have written a menu item and passed two arguments in it.

$items['a/b/c/d/e/%/edit/%ctools_js'] = array(
    'page callback' =&gt; 'generate_tpls_callback',
    'page arguments' =&gt; array(5,7),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
    'file' =&gt; 'tpl_popup_create.inc'
  );


Now in this callback I am getting both 5th and 7th argument. But when I pass it to $form_state, form is unable to get this 5th argument. I will explain you more with the help of code.

function generate_tpls_callback($cid, $ajax) {
    if ($ajax) {
        ctools_include('ajax');
        ctools_include('modal');

        $form_state = array(
            'ajax' =&gt; TRUE,
            'title' =&gt; t('Display box to change title'),
            'cid' =&gt; $cid,
        );
        $output = ctools_modal_form_wrapper('myform', $form_state);
        if (!empty($form_state['ajax_commands'])) {
            $output = $form_state['ajax_commands'];
        }
        print ajax_render($output);
        drupal_exit();
    } else {
        print_r("helloooo");
//        
    }

}


So, the issue is, when I click a link say "generate tpl" a popup appears that contains form items. I want the above 5th argument appears in this form. i.e. $cid. How can I do this. Please help.
You must use $form_state to do it. 

$form_state['build_info']['args'] = array($node);

function generate_tpls_callback($cid, $ajax) {
    if ($ajax) {
        ctools_include('ajax');
        ctools_include('modal');

        $form_state = array(
            'ajax' =&gt; TRUE,
            'title' =&gt; t('Display box to change title'),
            'cid' =&gt; $cid,
        );
        $form_state['build_info']['args'] = array($myvar);  //Check form below
        $output = ctools_modal_form_wrapper('myform', $form_state);
        if (!empty($form_state['ajax_commands'])) {
            $output = $form_state['ajax_commands'];
        }
        print ajax_render($output);
        drupal_exit();
    } else {
    }

}

function myform($form, &amp;$form_state, $myvar) {
...
}