I am using ctools modal dialog/popup window to display some records. The default close button is working fine. How can I add a custom close button?
Thanks
I am using ctools modal dialog/popup window to display some records. The default close button is working fine. How can I add a custom close button?
Thanks
As for this issue commited on November '11, you should be able to close any CTools modal window with a link that has the class "ctools-close-modal"
For example, in my modal I've got this for element to cancel and close:
$form['actions']['cancel'] = array(
'#markup' => l(t('Cancel'), '#',
array(
'attributes' => array(
'class' => 'ctools-close-modal'
),
'external' => TRUE
)
)
);
Just add CSS class ctools-close-modal
to any element inside the dialog like this:
$form['close_link']['#markup'] = '<span class="ctools-close-modal"> × </span>
<a href="#" class="ctools-close-modal">or click here.</span>';
$form['actions']['cancel_button2'] = array( '#markup' => '<span class="ctools-close-modal"> × </span><a href="#" class="ctools-close-modal">or click here.</span>', );
but its not working. I have opened the view developed page in ctools model. I tried this `// add a close popup button $form['actions']['cancel_button'] = array( '#type' => 'submit', '#value' => t('Save'), '#submit' => array('close_model_dialog'), );' and submit
// function to close the model dialog function close_model_dialog($form, &$form_state) { ctools_include('ajax'); ctools_include('modal'); $form_state['redirect'] = TRUE; $form_state['redirect'] = "fee/add"; $output = array(); $output[] = ctools_modal_command_dismiss(); print ajax_render($output); exit; }
but its not working as showing error in case of paging in view.