Ok so I’m having another go at extensions and can set the extension up ok, call it and get the code processed. The code runs fine but I can’t get it to return to where it came from.
Here’s my code (I’ve stripped out the processing code for debugging). Am I doing something wrong? I thought
$EXT->end_script = TRUE;
was meant to return me to the original function? Any help would be greatly appreciated! I just want to hand the reins back over to where it came from..
<?php
if ( ! defined('EXT'))
{
exit('Invalid file request');
}
class freeform_module_insert_begin
{
var $settings = array();
var $name = 'Freeform to Salesforce';
var $version = '0.1';
var $description = 'Sends Freeform Data To Salesforce';
var $settings_exist = 'n';
var $docs_url = '';//'http://expressionengine.com';
// -------------------------------
// Constructor - Extensions use this for settings
// -------------------------------
function freeform_module_insert_begin($settings='')
{
$this->settings = $settings;
}
function Example_extension($data)
{
global $EXT;
/*
========================================================================
My code in here
I want it to return to the Freeform Processing After This
========================================================================
*/
$EXT->end_script = TRUE;
}
// END
// --------------------------------
// Activate Extension
// --------------------------------
function activate_extension()
{
global $DB;
$DB->query($DB->insert_string('exp_extensions',
array(
'extension_id' => '',
'class' => "freeform_module_insert_begin",
'method' => "Example_extension",
'hook' => "freeform_module_insert_begin",
'settings' => "",
'priority' => 10,
'version' => $this->version,
'enabled' => "y"
)
)
);
}
// END
// --------------------------------
// Disable Extension
// --------------------------------
function disable_extension()
{
global $DB;
$DB->query("DELETE FROM exp_extensions WHERE class = 'freeform_module_insert_begin'");
}
// END
}
// END CLASS
?>
Hi Shape,
With EE extensions, if the end_script variable set to TRUE your extension data (if any) is sent back to the original calling script and then the original function ends. You would want that variable set to FALSE to allow the calling script to continue processing from after the extension function call. I’m not sure that it would be different in Freeform.
Cheers
Dry
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.