I am successfully using the modal frame api module, modal frame api contrib module with the admin theme (garland). I see the jquery.ui, modal_frame, and modal_frame_contrip scripts in the source and everything works just great.

My question lies in why the modal frame scripts are not loading in my custom sub-theme which is based off zen.

In order to get the module to work on sub-themes, am I required to add references to the location of the api scripts in my theme's theme.info file, or should they automatically be loading into my theme since the module has been enabled via the admin > site building > module page? I thought this would automatically load the scripts into the pages.

My end goal is to simply trigger a modal pop-up from a link in a content block. The pop-up would include two links for anonymous users, who would then select one to visit a third-party website. Is it necessary to create a custom module for this custom pop-up?

Any insight would be greatly appreciated. So far, the module looks great on the admin side, just need the scripts to load for public users.

Thanks!

DG

Comments

markus_petrux’s picture

Status: Active » Postponed (maintainer needs more info)

You shouldn't be doing anything different. Maybe the sub-theme is missing something critical to javascript, but that would affect not only modalframe, but other javascript related stuff,or maybe the theme is adding something that conflicts with modalframe.

Try to see if there's any javascript error, or anything in the Drupal logs. Also, try comparing the javascript files that are included in the same page using garland or your Zen based theme. Or try to debug the flow of execution of the javascript behaviors that make use of the Modal Frame API to find out where it breaks.

Also, make sure the versions of the libraries jQuery and jQuery UI are matching the requirements. You should be using the libraries jQuery 1.3.x and jQuery UI 1.7.x. Check site status report, but also recheck looking at the source code of your pages.

burnbright’s picture

First, thank you for the quick reply.

Other javascripts are loading on the sub-themes, and the correct version of jQuery and jQuery UI are installed. I don't see any javascript errors, but I think I may not be explaining the issue correctly. In the How-To section of the modal frame api, it says "The parent page should invoke modalframe_parent_js() somewhere in your module, before theme ('page') is executed."

My question is related to how i do this. Would adding modalframe_parent_js() to the content block which contains the link that I want to add the pop-up to be appropriate, or does this function need to be invoked from the template itself, or does it need to be invoked from a new custom module that i write just for my type of modal pop-up?

DG

burnbright’s picture

Hello, any more thoughts on this? All I am trying to do is make a small modal pop-up from a link in a content block. Is the best way to do this to write a custom module that creates a block that hold the content and scripts, or can I simply add the javascript code to a content block I created though the admin blocks page?

I am trying to understanding the proper "drupal" way to do this. Any help is appreciated. Thanks!

DG

burnbright’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I was able to fix this here by creating a new module with this code, in case anyone else is wondering:

function modalframe_whoareyou2_init() {
	$url = request_uri();

if (!empty($_COOKIE['has_js'])) {
if ($url == '/content/help-me-better-search') {
      modalframe_whoareyou2_add_js('child');
    }
	
	  else {
	 modalframe_whoareyou2_add_js('parent') ;
    }	
}
 }

Thanks...

burnbright’s picture

Status: Closed (fixed) » Active

Whoops... seems like there's something missing on this function. The "parent" script is loading on every page except the home page. Any thoughts?


function modalframe_whoareyou2_init() {
	$url = request_uri();

if (!empty($_COOKIE['has_js'])) {
if ($url == '/content/help-me-better-search') {
      modalframe_whoareyou2_add_js('child');
    }

	  else {
	 modalframe_whoareyou2_add_js('parent') ;
    }	
}
 }

dsnopek’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Loads in normal site theme for me! Closing.