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' => 'generate_tpls_callback',
'page arguments' => array(5,7),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
'file' => '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' => TRUE,
'title' => t('Display box to change title'),
'cid' => $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.