Javascript not loaded in loading ctools modal
this looks like a hook_menu() implementation:

$items['share/%ctools_js/%'] = array(
// 'page callback' =&gt; 'ym_alter_sharing_content',
'page callback' =&gt; 'ym_alter_sharing_callback',
'page arguments' =&gt; array(1),
'access callback' =&gt; 'user_is_logged_in',
'type' =&gt; MENU_CALLBACK,


);

you should wrap it in a corresponding function and return menu items:

function your_module_name_menu() {
  $items['share/%ctools_js/%'] = array(
    // 'page callback' =&gt; 'ym_alter_sharing_content',
    'page callback' =&gt; 'ym_alter_sharing_callback',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; 'user_is_logged_in',
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}


other code seems to be ok.
Hope this helps someone.