This should be possible by invoking Drupal.CTools.Modal.show
directly. The function takes one argument (the modal-style), which either can be a string pointing to an object on Drupal.settings
or the style-object itself.
After showing the dialog, it is possible to populate title and content using jQuery:
Drupal.CTools.Modal.show('my-modal-style');
$('#modal-title').html('my-title');
$('#modal-content').html('some markup here').scrollTop(0);
Drupal.attachBehaviors();
In your PHP code, you need to ensure that ctools modal.js
and also misc/ajax.js
gets loaded:
drupal_add_js('misc/ajax.js');
ctools_add_js('modal');
ctools_add_css('modal');
// Add your modal style to the settings. You find the defaults in modal.js near the top:
drupal_add_js(array(
'my-modal-style' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 250,
'height' => 250,
),
'closeText' => 'Dismiss',
'closeImage' => ...
),
), 'setting');