Easy modal popups with CTools Auto-modal

Objective:

By clicking on the link - load content by AJAX from a specific URL and display in modal CTools popup.

What do we have: 

Solution:

Create menu item via HOOK_menu() and set 'modal' property to TRUE. That's all. Just print link anywhere via l() function. CTools Auto-modal will automatically add JS and classes for links.

/** 
 * Implements HOOK_menu() 
 */ 
function mymodule_menu() {
   $items['mymodule/form'] = array(
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mymodule_form'),
     'access arguments' => array('administer mymodule'),
     'modal' => TRUE, // This line is where the magic happens.
   ); 
}

Clear cache and print link via l() function.

print l(t('Click me! I`m a modal'), 'mymodule/form');

Profit!

Links:

English