Hi Merlin,

As per a brief discussion in IRC, my issue:

I recently took it upon myself to release a rewrite of Mobile Codes for D6 utilizing CTools Exportables and Export UI to do the majority of the heavy lifting, and to provide a nice UI I incorporated some AHAH elements to the form. This all worked/works fine and dandy.

However, I then decided to port said rewrite to D7, which at first was relatively easy, until of course I hit a somewhat major snag. Export UI and Drupal 7's #AJAX callback method don't really play together too nicely. I did come across something similar to this issue while working on D6, but was able to work around it. I have not yet been able to work around the issue in D7.

 

When using #AJAX in an Export UI form, you will receive the following error:

Call to undefined function ctools_export_get_schema() in /[path]/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php on line 977

I suspect that this is due to the way that CTools creates a dynamically generated form function.

I have also attempted to work around this issue by using the #AJAX path method, but have not yet had any luck going down that path.

 

Primarily I'm looking for a pointer on how you yourself would approach this conundrum, is the CTools AJAX path the correct path, and if so how so?

Cheers,
Deciphered.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

Deciphered’s picture

Temporary solution (supplied by Merlin) was to insert the following line before line 977 of the referenced file:

ctools_include('export');

Deciphered’s picture

Alternative fix, on the side of the module invoking the callback you can use the following:

/**
 * Implements hook_init().
 */
function HOOK_init() {
  if (strstr(request_uri(), 'system/ajax') && $_POST['form_id'] == 'ctools_export_ui_edit_item_form') {
    ctools_include('export');
  }
}
amateescu’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev

The Delta module has this issue in 3.0-beta5 and 3.0-dev on the add new template form.

Deciphered’s picture

amateescu,

I use the workaround in #2 in a few CTools/#AHAH combinations and it works perfectly for me, so I recommend cross posting the solution to the Delta module to alert them to the solution.

Cheers,
Deciphered.

merlinofchaos’s picture

Category: support » bug
Status: Active » Needs review
FileSize
1.2 KB

Does this patch fix the problem with delta module?

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Yes, this patch fixes the problem in Delta.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Looks like I committed this on Monday but forgot to mark the issue fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.