<div dir="ltr">I&#39;m running into css issues theming a ctools modal popup, because there isn&#39;t a class or id in it specific to its context... that is, any ctools modal popup on the site has the same ones.<div><br></div>
<div>So, I&#39;m trying to theme it so that I can add a class, and am going by what I see in its own example as well as one of the better ones I found, here: <a href="http://drupion.com/blog/10-steps-creating-ctools-modal-window-drupal-7">http://drupion.com/blog/10-steps-creating-ctools-modal-window-drupal-7</a><br clear="all">
<div><br></div><div>The code I have is below. The js from the module that process the modal fires (I put an alert at the start of it), but for some reason its contents are never used instead of the ctools default html.</div>
<div><br></div><div><div>function mymod_callback($ajax, $nid) {</div><div>  $_SESSION[&#39;nid&#39;] = $nid;</div><div>  if ($ajax) {</div><div>    ctools_include(&#39;ajax&#39;);</div><div>    ctools_include(&#39;modal&#39;);</div>
<div><br></div><div>    $form_state = array(</div><div>      &#39;ajax&#39; =&gt; TRUE,</div><div>      &#39;title&#39; =&gt; t(&#39;title),</div><div>    );</div><div><br></div><div>    $output = ctools_modal_form_wrapper(&#39;mymod_form&#39;, $form_state);<br>
</div><div><br></div><div>    if (!empty($form_state[&#39;ajax_commands&#39;])) {<br></div><div>      $output = $form_state[&#39;ajax_commands&#39;];</div><div>    }</div><div><br></div><div>    print ajax_render($output);<br>
</div><div>    drupal_exit();</div><div>  }</div><div>  else {</div><div>    return drupal_get_form(&#39;mymod_form&#39;);</div><div>  }</div><div>}</div></div><div><br></div><div><div>function mymod_make_share_link($nid) {</div>
<div>  ctools_include(&#39;ajax&#39;);</div><div>  ctools_include(&#39;modal&#39;);</div><div>  return ctools_modal_image_button(file_create_url(&#39;public://icons/myimg.png&#39;), &#39;myform/&#39; . $nid . &#39;/nojs&#39;, t(&#39;title&#39;), &#39;ctools-modal-mymodal-style&#39;);<br>
</div><div>}</div></div><div><br></div><div>Then in the page pre-process </div><div><br></div><div><div>  ctools_include(&#39;modal&#39;);<br></div><div>  ctools_modal_add_js();</div><div>  $mymodal_style = array(</div><div>
    &#39;mymodal-style&#39; =&gt; array (</div><div>      &#39;modalTheme&#39; =&gt; &#39;myModal&#39;,</div><div>    )</div><div>  );</div><div>  drupal_add_js($mymodal_style, &#39;setting&#39;);</div><div>  ctools_add_js(&#39;mymodal&#39;, &#39;mymod&#39;);</div>
<div>  ctools_add_css(&#39;mymodal&#39;, &#39;mymod&#39;);</div><div>}</div></div><div><br></div><div>And finally, in the js file</div><div><br></div><div><div>  (function ($) {</div><div>    Drupal.theme.prototype.myModal = function () {</div>
<div>      var html = &#39;&#39;</div><div>      html += &#39;  &lt;div id=&quot;ctools-modal&quot; class=&quot;mymodal&quot;&gt;&#39;</div><div>... other markup<br></div><div><br></div><div>      return html;</div><div>    }</div>
<div>  })(jQuery);</div></div><div><br></div>-- <br>---<div><a href="http://drupal.org/user/367108" target="_blank">drupal.org/user/367108</a></div><div><a href="http://linkedin.com/in/jeffrgreenberg" target="_blank">linkedin.com/in/jeffrgreenberg</a></div>
<div><a href="http://accidentalcoder.com" target="_blank">accidentalcoder.com</a> / <a href="http://ayendesigns.com" target="_blank">ayendesigns.com</a></div><div>@accidentalcoder</div>
</div></div>