Firing a Ctools Modal on a link click Once again, I am stuck asking questions on CTools that people have asked a million times before. I have a view that displays a list of custom-developed entities (built with ECK) and each one has a link that should show a Ctools-driven modal. 

I looked at a few approaches (namely this) to explore any method to get Drupal to display said modal. I figured that I didn't need all this extra views hook logic to fire the modal -- ideally, if a hook_menu() click is fired, it should open the modal and any contents I send to it (which will be done through additional methods). Right now, it treats the logic as a static route, and returns the results as a page. I also explored using the Ctools Auto Modal module (seen in the example, which reflects current code), which also returns the same results when used as documented.

I'm completely lost here, mostly because of the reach of Ctools and the various conflicting forms of documentation on its use for something simple as a tie in for hook_menu(). The long hours i've been pouring into this project are clearly having a toll on my ability to implement this, does anyone have any insight?

The actual logic is below:

/**
 * Implements hook_menu()
 *
 * The sole item call in hook_menu is driven from a URL that is built
 * Within a view, from rewrite rules. When activated, it should render
 * the new modal window.
 */
function example_menu() {
  $items['selectbook/%'] = array(
    'title' =&gt; "Perk Modal",
    'page arguments' =&gt; array(1),
    'page callback' =&gt; 'example_modal_page',
    'access arguments' =&gt; array('view content'),
    'access callback' =&gt; TRUE,
    'modal' =&gt; TRUE,
  );

  return $items;
}

/**
 * Returns a test modal
 */
function example_modal_page($js = null, $attribute = null) {
  return "Test Modal"; //Right now returns as new page call not as a modal
}
You mentioned you tried ctools_automodal which is a quick way to accomplish creating a link in a view to open in a modal. With the module, you can use hook_menu_alter to add 'modal' => TRUE to the link menu router item. Nothing else is involved. Ctools_automodal handles all the rest. That means you don't need your own example_modal_page page callback, and you don't need to call ctools_modal_render. Let the Ctool_automodal module do that for you.

If your path has a wildcard, then ctools_automodal will need an actual wildcard variable defined and a "_load" function. In your example above, your path is selectbook/%. If you change it to "selectbook/%selectbook" and defined a selectbook_load function then ctools_automodal should recognize it as a modal path. Here's an example:

/**
 * Implements hook_menu().
 *
 * The sole item call in hook_menu is driven from a URL that is built
 * from rewrite rules within a view. When activated, it should render
 * the new modal window.
 */
function example_menu() {
  $items['selectbook/%selectbook'] = array(
    'title' =&gt; "Perk Modal",
    'page arguments' =&gt; array(1),
    'page callback' =&gt; 'example_modal_page',
    'access arguments' =&gt; array('view content'),
    'modal' =&gt; TRUE,
  );

  return $items;
}

function selectbook_load($selectbook) {
  // Todo: Do something with selectbook, like load an entity.
  // For this proof of concept, just return it.
  return $selectbook;
}

function example_modal_page($selectbook) {
  // If you loaded an entity in selectbook_load, then you have that
  // fully loaded entity in $selectbook.
  return "Test Modal";
}